java.lang.Object
dev.metaschema.core.metapath.StaticContext.Builder
- Enclosing class:
- StaticContext
A builder used to generate the static context.
-
Method Summary
Modifier and TypeMethodDescriptionSets the static base URI to use in resolving URIs handled by the Metapath processor, when a document base URI is not available.build()Construct a new static context using the information provided to the builder.A convenience method fordefaultFunctionNamespace(URI).defaultFunctionNamespace(URI namespace) Defines the default namespace to use for assembly, field, or flag references that have no namespace prefix.defaultLanguage(String language) Defines the default language to be used by functions like fn:lang() when processing language-sensitive operations.A convenience method fordefaultModelNamespace(URI).defaultModelNamespace(URI namespace) Defines the default namespace to use for assembly, field, or flag references that have no namespace prefix.functionResolver(IFunctionResolver resolver) Set the function resolver used to lookup function implementations.A convenience method fornamespace(String, URI).Adds a new prefix to namespace URI binding to the mapping of statically known namespaces.useWildcardWhenNamespaceNotDefaulted(boolean value) Set the name matching behavior for when a model node has no namespace.
-
Method Details
-
baseUri
Sets the static base URI to use in resolving URIs handled by the Metapath processor, when a document base URI is not available. There is only a single base URI. Subsequent calls to this method will change the base URI.- Parameters:
uri- the base URI to use- Returns:
- this builder
-
namespace
Adds a new prefix to namespace URI binding to the mapping of statically known namespaces.A namespace set by this method can be resolved using the
StaticContext.lookupNamespaceForPrefix(String)method.Well-known namespace bindings are used by default, which are provided by
WellKnown.- Parameters:
prefix- the prefix to associate with the namespace, which may beuri- the namespace URI- Returns:
- this builder
- See Also:
-
namespace
A convenience method fornamespace(String, URI).- Parameters:
prefix- the prefix to associate with the namespace, which may beuri- the namespace URI- Returns:
- this builder
- Throws:
IllegalArgumentException- if the provided prefix or URI is invalid- See Also:
-
defaultModelNamespace
Defines the default namespace to use for assembly, field, or flag references that have no namespace prefix.- Parameters:
namespace- the namespace URI- Returns:
- this builder
-
defaultModelNamespace
A convenience method fordefaultModelNamespace(URI).- Parameters:
uri- the namespace URI- Returns:
- this builder
- Throws:
IllegalArgumentException- if the provided URI is invalid
-
defaultFunctionNamespace
Defines the default namespace to use for assembly, field, or flag references that have no namespace prefix.- Parameters:
namespace- the namespace URI- Returns:
- this builder
-
defaultFunctionNamespace
A convenience method fordefaultFunctionNamespace(URI).- Parameters:
uri- the namespace URI- Returns:
- this builder
- Throws:
IllegalArgumentException- if the provided URI is invalid
-
defaultLanguage
Defines the default language to be used by functions like fn:lang() when processing language-sensitive operations.If not set, the JVM's default locale language code will be used (e.g., "en" for English systems, "fr" for French systems).
- Parameters:
language- the language code (e.g., "en", "fr", "de")- Returns:
- this builder
- See Also:
-
useWildcardWhenNamespaceNotDefaulted
Set the name matching behavior for when a model node has no namespace.- Parameters:
value-trueif on orfalseotherwise- Returns:
- this builder
-
functionResolver
Set the function resolver used to lookup function implementations.By default, the
FunctionServiceis used to load function implementations using the service provider interface.- Parameters:
resolver- the resolver to use instead of the default resolver- Returns:
- this builder
-
build
Construct a new static context using the information provided to the builder.- Returns:
- the new static context
-