2626import org .apache .commons .lang3 .Validate ;
2727import org .semanticweb .vlog4j .core .model .api .Constant ;
2828import org .semanticweb .vlog4j .core .model .api .DataSource ;
29+ import org .semanticweb .vlog4j .core .model .api .DataSourceDeclaration ;
2930import org .semanticweb .vlog4j .core .model .api .PrefixDeclarations ;
3031import org .semanticweb .vlog4j .core .model .implementation .Expressions ;
3132import org .semanticweb .vlog4j .parser .javacc .SubParserFactory ;
@@ -39,12 +40,12 @@ public class ParserConfiguration {
3940 /**
4041 * The registered data sources.
4142 */
42- private HashMap <String , DataSourceDeclarationHandler > dataSources = new HashMap <>();
43+ private final HashMap <String , DataSourceDeclarationHandler > dataSources = new HashMap <>();
4344
4445 /**
4546 * The registered datatypes.
4647 */
47- private HashMap <String , DatatypeConstantHandler > datatypes = new HashMap <>();
48+ private final HashMap <String , DatatypeConstantHandler > datatypes = new HashMap <>();
4849
4950 /**
5051 * Register a new (type of) Data Source.
@@ -53,8 +54,8 @@ public class ParserConfiguration {
5354 * production of the rules grammar, corresponding to some {@link DataSource}
5455 * type.
5556 *
56- * @see <"https://github.com/knowsys/vlog4j/wiki/Rule-syntax-grammar"> for the
57- * grammar.
57+ * @see <a href= "https://github.com/knowsys/vlog4j/wiki/Rule-syntax-grammar">
58+ * the grammar</a> .
5859 *
5960 * @param name Name of the data source, as it appears in the declaring
6061 * directive.
@@ -63,9 +64,9 @@ public class ParserConfiguration {
6364 * @throws IllegalArgumentException if the provided name is already registered.
6465 * @return this
6566 */
66- public ParserConfiguration registerDataSource (String name , DataSourceDeclarationHandler handler )
67+ public ParserConfiguration registerDataSource (final String name , final DataSourceDeclarationHandler handler )
6768 throws IllegalArgumentException {
68- Validate .isTrue (!dataSources .containsKey (name ), "The Data Source \" %s\" is already registered." , name );
69+ Validate .isTrue (!this . dataSources .containsKey (name ), "The Data Source \" %s\" is already registered." , name );
6970
7071 this .dataSources .put (name , handler );
7172 return this ;
@@ -87,9 +88,9 @@ public ParserConfiguration registerDataSource(String name, DataSourceDeclaration
8788 *
8889 * @return the Data Source instance.
8990 */
90- public DataSource parseDataSourceSpecificPartOfDataSourceDeclaration (String name , List <String > args ,
91+ public DataSource parseDataSourceSpecificPartOfDataSourceDeclaration (final String name , final List <String > args ,
9192 final SubParserFactory subParserFactory ) throws ParsingException {
92- DataSourceDeclarationHandler handler = dataSources .get (name );
93+ final DataSourceDeclarationHandler handler = this . dataSources .get (name );
9394
9495 if (handler == null ) {
9596 throw new ParsingException ("Data source \" " + name + "\" is not known." );
@@ -104,30 +105,29 @@ public DataSource parseDataSourceSpecificPartOfDataSourceDeclaration(String name
104105 * @param lexicalForm the (unescaped) lexical form of the constant.
105106 * @param languageTag the language tag, or null if not present.
106107 * @param the datatype, or null if not present.
107- * @note At most one of {@code languageTag} and {@code datatype} may be
108- * non-null.
108+ * @pre At most one of {@code languageTag} and {@code datatype} may be non-null.
109109 *
110110 * @throws ParsingException when the lexical form is invalid for the
111111 * given data type.
112112 * @throws IllegalArgumentException when both {@code languageTag} and
113113 * {@code datatype} are non-null.
114114 * @return the {@link Constant} corresponding to the given arguments.
115115 */
116- public Constant parseConstant (String lexicalForm , String languageTag , String datatype )
116+ public Constant parseConstant (final String lexicalForm , final String languageTag , final String datatype )
117117 throws ParsingException , IllegalArgumentException {
118- Validate .isTrue (languageTag == null || datatype == null ,
118+ Validate .isTrue (( languageTag == null ) || ( datatype == null ) ,
119119 "A constant with a language tag may not explicitly specify a data type." );
120120
121121 if (languageTag != null ) {
122122 return Expressions .makeLanguageStringConstant (lexicalForm , languageTag );
123123 } else {
124- return parseDatatypeConstant (lexicalForm , datatype );
124+ return this . parseDatatypeConstant (lexicalForm , datatype );
125125 }
126126 }
127127
128- private Constant parseDatatypeConstant (String lexicalForm , String datatype ) throws ParsingException {
129- String type = ((datatype != null ) ? datatype : PrefixDeclarations .XSD_STRING );
130- DatatypeConstantHandler handler = datatypes .get (type );
128+ private Constant parseDatatypeConstant (final String lexicalForm , final String datatype ) throws ParsingException {
129+ final String type = ((datatype != null ) ? datatype : PrefixDeclarations .XSD_STRING );
130+ final DatatypeConstantHandler handler = this . datatypes .get (type );
131131
132132 if (handler != null ) {
133133 return handler .createConstant (lexicalForm );
@@ -148,9 +148,9 @@ private Constant parseDatatypeConstant(String lexicalForm, String datatype) thro
148148 *
149149 * @return this
150150 */
151- public ParserConfiguration registerDatatype (String name , DatatypeConstantHandler handler )
151+ public ParserConfiguration registerDatatype (final String name , final DatatypeConstantHandler handler )
152152 throws IllegalArgumentException {
153- Validate .isTrue (!datatypes .containsKey (name ), "The Data type \" %s\" is already registered." , name );
153+ Validate .isTrue (!this . datatypes .containsKey (name ), "The Data type \" %s\" is already registered." , name );
154154
155155 this .datatypes .put (name , handler );
156156 return this ;
0 commit comments