You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by GitBox <gi...@apache.org> on 2022/12/16 10:28:19 UTC

[GitHub] [jena] afs commented on a diff in pull request #1677: GH-1676: Helper methods for registered language retrieval

afs commented on code in PR #1677:
URL: https://github.com/apache/jena/pull/1677#discussion_r1050559559


##########
jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java:
##########
@@ -171,6 +172,16 @@ public static ReaderRIOTFactory getFactory(Lang language) {
     /** return true if the language is registered with the quads parser factories */
     public static boolean isQuads(Lang lang)   { return langQuads.contains(lang); }
 
+    /** Return registered triple languages. */
+    public static Set<Lang> registeredLangTriples() {
+        return Collections.unmodifiableCollection(langTriples);
+    }
+
+    /** Return registered quad languages. */
+    public static Set<Lang> registeredLangQuads() {
+        return Collections.unmodifiableCollection(langQuads);
+    }
+

Review Comment:
   `Set.copyOf`



##########
jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java:
##########
@@ -171,6 +172,16 @@ public static ReaderRIOTFactory getFactory(Lang language) {
     /** return true if the language is registered with the quads parser factories */
     public static boolean isQuads(Lang lang)   { return langQuads.contains(lang); }
 
+    /** Return registered triple languages. */
+    public static Set<Lang> registeredLangTriples() {
+        return Collections.unmodifiableCollection(langTriples);
+    }

Review Comment:
   Better is `Set.copyOf(langTriples)` because it is thread safe.
   
   Bonus for changing `RDFWriterRegistry.registered*Formats` to use `copyOf`.



##########
jena-arq/src/main/java/org/apache/jena/riot/resultset/ResultSetReaderRegistry.java:
##########
@@ -77,6 +78,11 @@ public static void init() {
         register(RS_Thrift,   factory) ;
         register(RS_Protobuf, factory) ;
     }
+    
+    /** Return registered result set languages. */
+    public static Set<Lang> registered() {
+        return Collections.unmodifiableCollection(registry.keySet());

Review Comment:
   `Set.copyOf`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org