public class Configuration<Node> extends Object
Modifier and Type | Field and Description |
---|---|
protected Map<String,SelectorFunction<Node>> |
functions
A map from function URIs (e.g.
|
protected Map<String,String> |
namespaces
A map from namespace prefixes to namespace URIs
|
protected Map<String,TestFunction<Node>> |
testFunctions
A map from function URIs (e.g.
|
protected Map<String,NodeTransformer<?,Node>> |
transformers
A map from type URIs (e.g.
|
Constructor and Description |
---|
Configuration() |
Modifier and Type | Method and Description |
---|---|
void |
addFunction(String uri,
SelectorFunction<Node> function)
Add a mapping from a URI to a
SelectorFunction implementation to the configuration. |
void |
addNamespace(String prefix,
String uri)
Add a namespace prefix to URI mapping to this configuration.
|
void |
addTestFunction(String uri,
TestFunction<Node> test)
Add a mapping from an URI to a
TestFunction inplementation to the configuration. |
void |
addTransformer(String uri,
NodeTransformer<?,Node> transformer)
Add a mapping from a type URI to a
NodeTransformer . |
Map<String,SelectorFunction<Node>> |
getFunctions()
Return an immutable map of the registered functions.
|
Map<String,String> |
getNamespaces()
Return an immutable map of the registered namespaces.
|
Map<String,TestFunction<Node>> |
getTestFunctions()
Return an immutable map of the registered function tests.
|
Map<String,NodeTransformer<?,Node>> |
getTransformers()
Return an immutable map of the registered transformers.
|
void |
removeFunction(String uri)
Remove the function registered under the given URI.
|
void |
removeNamespace(String prefix)
Remove the namespace with the prefix given as argument.
|
void |
removeTestFunction(String uri)
Remove the test function registered under the given URI.
|
void |
removeTransformer(String uri)
Remove the transformer registered with the URI given as argument
|
protected Map<String,NodeTransformer<?,Node>> transformers
protected Map<String,SelectorFunction<Node>> functions
protected Map<String,TestFunction<Node>> testFunctions
public Map<String,String> getNamespaces()
ImmutableMap
of the registered namespaces.public Map<String,NodeTransformer<?,Node>> getTransformers()
ImmutableMap
of the registered transformers.public Map<String,SelectorFunction<Node>> getFunctions()
ImmutableMap
of the registered SelectorFunction
s.public Map<String,TestFunction<Node>> getTestFunctions()
ImmutableMap
of the registered TestFunction
s.public void addNamespace(String prefix, String uri)
prefix
- the namespace prefix to be used for the URI as a stringuri
- the URI of the namespace to map to as a stringpublic void removeNamespace(String prefix)
prefix
- the namespace prefix to remove as a stringpublic void addFunction(String uri, SelectorFunction<Node> function)
SelectorFunction
implementation to the configuration.
Registered selector functions will be available under their URIs during program parsing.
Function calls are not thread safe and the order of function calls is not predictable;
they should therefore not hold any state.
Example:fn:concat(...)
is a mapping from http://www.newmedialab.at/lmf/functions/1.0/ to an instance
of ConcatenateFunction
Note that currently you can only use the http://www.newmedialab.at/lmf/functions/1.0/ namespace for
registering functions.uri
- the URI under which to register the selector function as a stringfunction
- an instance of the selector function implementation to use for this URIpublic void removeFunction(String uri)
uri
- a string representing the URI under which the function has been registered.public void addTestFunction(String uri, TestFunction<Node> test)
TestFunction
inplementation to the configuration.
Registered test functions will be available under their URIs during program parsing.
Function calls are not thread safe and the order of function calls in not predictable;
they should therefore not hold any state.
Example:fn:eq(...)
is a mapping from http://www.newmedialab.at/lmf/functions/1.0/eq to an instance
of EqualTest
Note that currently you can only use the http://www.newmedialab.at/lmf/functions/1.0/ namespace for
registering functions.uri
- the URI under which to register the selector function as a stringtest
- an instance of the test function implementation for this URIpublic void removeTestFunction(String uri)
uri
- a string representing the URI under which the test function has been registered.public void addTransformer(String uri, NodeTransformer<?,Node> transformer)
NodeTransformer
. The values of fields with a
type specification with this URI will be transformed to other Java types using this transformer.
Example:... :: xsd:int
will transform the values of the field to Java integer values using
an instance of IntTransformer
uri
- a string identifying the URI for which to register the transformertransformer
- public void removeTransformer(String uri)
uri
- a string representing the URI under which the transformer is registeredCopyright © 2012–2018 The Apache Software Foundation. All rights reserved.