-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder used to generate the static context. -
Method Summary
Modifier and TypeMethodDescriptionstatic StaticContext.Builderbuilder()Create a new static context builder that allows for fine-grained adjustments when creating a new static context.Get a new static context builder that is pre-populated with the setting of this static context.Get the static base URI to use in resolving URIs handled by the Metapath processor.Get the default language to be used by functions like fn:lang() when processing language-sensitive operations.static StringDeprecated, for removal: This API element is subject to removal in a future version.static StaticContextinstance()Create a new static context instance using default values.booleanIndicates if a name match should use a wildcard for the namespace if the namespace does not have a value and the default model namespace isnull.static IAtomicOrUnionType<?>lookupAtomicType(IEnhancedQName qname) Lookup a known Metapath atomic type based on the type's qualified name.static <T extends IAnyAtomicItem>
IAtomicOrUnionType<T>lookupAtomicType(Class<T> clazz) Lookup a known Metapath atomic type based on the type's item class.lookupAtomicType(String name) Lookup the atomic type with the provided name in the static context.lookupFunction(IEnhancedQName qname, int arity) Lookup a known Metapath function based on the function's name and arity.lookupFunction(String name, int arity) Lookup a known Metapath function based on the function's name and arity.static IItemTypelookupItemType(Class<? extends IItem> clazz) Lookup a known Metapath item type based on the type's item class.lookupNamespaceForPrefix(String prefix) Get the namespace associated with the providedprefixas a string, if any is bound.lookupPrefixForNamespace(String namespace) Get the prefix associated with the providednamespaceas a string, if any is bound.parseAtomicTypeName(String name) Parse the name of an atomic type.parseFlagName(String name) Parse a flag name.parseFunctionName(String name) Parse a function name.parseModelName(String name) Parse a model name.parseVariableName(String name) Parse a variable name.
-
Method Details
-
getWellKnownPrefixForUri
@Deprecated(since="2.2.0", forRemoval=true) @Nullable public static String getWellKnownPrefixForUri(@NonNull String uri) Deprecated, for removal: This API element is subject to removal in a future version.Get the namespace prefix associated with the provided URI, if the URI is well-known.This method has been deprecated. While
WellKnown.getWellKnownPrefixForUri(String)can be used in place of this method.- Parameters:
uri- the URI to get the prefix for- Returns:
- the prefix or
nullif the provided URI is not well-known
-
instance
Create a new static context instance using default values.- Returns:
- a new static context instance
-
getBaseUri
Get the static base URI to use in resolving URIs handled by the Metapath processor. This URI, if provided, will be used when a document base URI is not available.- Returns:
- the base URI or
nullif not defined
-
lookupNamespaceForPrefix
Get the namespace associated with the providedprefixas a string, if any is bound.- Parameters:
prefix- the namespace prefix- Returns:
- the namespace string bound to the prefix, or
nullif no namespace is bound to the prefix
-
lookupPrefixForNamespace
Get the prefix associated with the providednamespaceas a string, if any is bound.- Parameters:
namespace- the namespace- Returns:
- the prefix string bound to the prefix, or
nullif no prefix is bound to the namespace
-
getDefaultLanguage
Get the default language to be used by functions like fn:lang() when processing language-sensitive operations.If no default language is configured, the JVM's default locale language code is returned (e.g., "en" for English systems, "fr" for French systems).
- Returns:
- the default language code, or the JVM's default locale language if not configured
- See Also:
-
parseAtomicTypeName
Parse the name of an atomic type.This method will attempt to identify the namespace corresponding to a given prefix.
The prefix will be resolved using the following lookup order, advancing to the next when a
nullvalue is returned:- Lookup the prefix using the namespaces registered with the static context.
- Lookup the prefix in the well-known namespaces.
If an empty prefix is provided, the
MetapathConstants.NS_METAPATHnamespace will be used.- Parameters:
name- the name- Returns:
- the parsed qualified name
- Throws:
StaticMetapathException- with the codeStaticMetapathException.PREFIX_NOT_EXPANDABLEif a non-empty prefix is provided
-
lookupAtomicType
Lookup the atomic type with the provided name in the static context.This method will first attempt to expand the namespace prefix for a lexical QName. A
StaticMetapathExceptionwith the codeStaticMetapathException.PREFIX_NOT_EXPANDABLEif the prefix is not known to the static context.Once the qualified name has been produced, the atomic type will be retrieved from the available atomic types. If the atomic type was not found, a
StaticMetapathExceptionwith the codeStaticMetapathException.UNKNOWN_TYPEwill be thrown. Otherwise, the type information is returned for the matching atomic type.- Parameters:
name- the namespace qualified or lexical name of the data type.- Returns:
- the data type information
- Throws:
StaticMetapathException- with the codeStaticMetapathException.PREFIX_NOT_EXPANDABLEif the lexical name was not able to be expanded or the codeStaticMetapathException.NO_FUNCTION_MATCHif a matching type was not found
-
lookupAtomicType
Lookup a known Metapath atomic type based on the type's qualified name.- Parameters:
qname- the qualified name- Returns:
- the type
- Throws:
StaticMetapathException- with the codeStaticMetapathException.UNKNOWN_TYPEif the type was not found
-
lookupAtomicType
@NonNull public static <T extends IAnyAtomicItem> IAtomicOrUnionType<T> lookupAtomicType(Class<T> clazz) Lookup a known Metapath atomic type based on the type's item class.- Type Parameters:
T- the Java type of the item to get the type information for- Parameters:
clazz- the item class associated with the atomic type- Returns:
- the type
- Throws:
StaticMetapathException- with the codeStaticMetapathException.UNKNOWN_TYPEif the type was not found
-
lookupItemType
Lookup a known Metapath item type based on the type's item class.- Parameters:
clazz- the item class associated with the atomic type- Returns:
- the type
- Throws:
StaticMetapathException- with the codeStaticMetapathException.UNKNOWN_TYPEif the type was not found
-
parseFunctionName
Parse a function name.This method will attempt to identify the namespace corresponding to a given prefix.
The prefix will be resolved using the following lookup order, advancing to the next when a
nullvalue is returned:- Lookup the prefix using the namespaces registered with the static context.
- Lookup the prefix in the well-known namespaces.
StaticContext.Builder.defaultFunctionNamespace(String)namespace will be used.- Parameters:
name- the name- Returns:
- the parsed qualified name
-
lookupFunction
Lookup a known Metapath function based on the function's name and arity.This method will first attempt to expand the namespace prefix for a lexical QName. A
StaticMetapathExceptionwith the codeStaticMetapathException.PREFIX_NOT_EXPANDABLEif the prefix is not known to the static context.Once the qualified name has been produced, the function will be retrieved from the available functions. If the function was not found, a
StaticMetapathExceptionwith the codeStaticMetapathException.UNKNOWN_TYPEwill be thrown. Otherwise, the data type information is returned for the matching data type.- Parameters:
name- the qualified or lexical name of the functionarity- the number of arguments- Returns:
- the type
- Throws:
StaticMetapathException- with the codeStaticMetapathException.PREFIX_NOT_EXPANDABLEif the lexical name was not able to be expanded or the codeStaticMetapathException.NO_FUNCTION_MATCHif a matching function was not found
-
lookupFunction
Lookup a known Metapath function based on the function's name and arity.- Parameters:
qname- the qualified name of the functionarity- the number of arguments- Returns:
- the function
- Throws:
StaticMetapathException- with the codeStaticMetapathException.NO_FUNCTION_MATCHif a matching function was not found
-
parseFlagName
Parse a flag name.This method will attempt to identify the namespace corresponding to a given prefix.
The prefix will be resolved using the following lookup order, advancing to the next when a
nullvalue is returned:- Lookup the prefix using the namespaces registered with the static context.
- Lookup the prefix in the well-known namespaces.
XMLConstants.NULL_NS_URInamespace will be used.- Parameters:
name- the name- Returns:
- the parsed qualified name
- Throws:
StaticMetapathException- with the codeStaticMetapathException.PREFIX_NOT_EXPANDABLEif a non-empty prefix is provided
-
parseModelName
Parse a model name.This method will attempt to identify the namespace corresponding to a given prefix.
The prefix will be resolved using the following lookup order, advancing to the next when a
nullvalue is returned:- Lookup the prefix using the namespaces registered with the static context.
- Lookup the prefix in the well-known namespaces.
StaticContext.Builder.defaultModelNamespace(String)namespace will be used.- Parameters:
name- the name- Returns:
- the parsed qualified name
-
parseVariableName
Parse a variable name.This method will attempt to identify the namespace corresponding to a given prefix.
The prefix will be resolved using the following lookup order, advancing to the next when a
nullvalue is returned:- Lookup the prefix using the namespaces registered with the static context.
- Lookup the prefix in the well-known namespaces.
XMLConstants.NULL_NS_URInamespace will be used.- Parameters:
name- the name- Returns:
- the parsed qualified name
-
buildFrom
Get a new static context builder that is pre-populated with the setting of this static context.- Returns:
- a new builder
-
isUseWildcardWhenNamespaceNotDefaulted
public boolean isUseWildcardWhenNamespaceNotDefaulted()Indicates if a name match should use a wildcard for the namespace if the namespace does not have a value and the default model namespace isnull.- Returns:
trueif a wildcard match on the name space should be used orfalseotherwise
-
builder
Create a new static context builder that allows for fine-grained adjustments when creating a new static context.- Returns:
- a new builder
-