- All Superinterfaces:
ICollectionValue,IItem
- All Known Subinterfaces:
IArrayItem<ITEM>,IMapItem<VALUE>
- All Known Implementing Classes:
dev.metaschema.core.metapath.function.impl.AbstractFunction,DefaultFunction
A common interface for all Metapath functions.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classUsed to create a function's signature using a builder pattern.static enumDetails specific characteristics of a function. -
Method Summary
Modifier and TypeMethodDescriptionintarity()Determine the number of arguments the function has.static IFunction.Builderbuilder()Construct a new function signature builder.static IFunction.Builderbuilder(StaticContext staticContext) Construct a new function signature builder.default booleandeepEquals(ICollectionValue other, DynamicContext dynamicContext) Determine if this and the other value are deeply equal.ISequence<?>execute(List<? extends ISequence<?>> arguments, DynamicContext dynamicContext, ISequence<?> focus) Execute the function with the providedarguments, using the providedDynamicContextandfocus.Retrieve the list of function arguments.default StringgetName()Retrieve the name of the function.Retrieve the set of assigned function properties.getQName()Retrieve the namespace qualified name of the function.Retrieve the function result sequence type.default IItemTypegetType()Get the type information for the item.default booleanDetermines if the final argument can be repeated.default booleanDetermines if the result of the function call depends on property values within the static or dynamic context and the provided arguments.default booleanDetermines if the result of the function call will produce identical results when provided the same implicit or explicit arguments.default booleanDetermines if the result of the function call depends on the current focus.booleanDetermine if the function is a named function.default IAnyAtomicItemGet the atomic value for the item.default StringGet the signature of the function as a string.static IItemTypetype()Get the type information for this item.Methods inherited from interface dev.metaschema.core.metapath.item.IItem
accept, atomize, contentsAsSequence, flatten, getValue, hasValue, toSequence
-
Method Details
-
type
Get the type information for this item.- Returns:
- the type information
-
getType
Description copied from interface:IItemGet the type information for the item. -
getName
Retrieve the name of the function.- Returns:
- the function's name
-
getQName
Retrieve the namespace qualified name of the function.- Returns:
- the namespace qualified name
-
getProperties
Retrieve the set of assigned function properties.- Returns:
- the set of properties or an empty set
-
getArguments
Retrieve the list of function arguments.- Returns:
- the function arguments or an empty list if there are none
-
arity
int arity()Determine the number of arguments the function has.- Returns:
- the number of function arguments
-
isDeterministic
default boolean isDeterministic()Determines if the result of the function call will produce identical results when provided the same implicit or explicit arguments.- Returns:
trueif function is deterministic orfalseotherwise- See Also:
-
isContextDepenent
default boolean isContextDepenent()Determines if the result of the function call depends on property values within the static or dynamic context and the provided arguments.- Returns:
trueif function is context dependent orfalseotherwise- See Also:
-
isFocusDependent
default boolean isFocusDependent()Determines if the result of the function call depends on the current focus.- Returns:
trueif function is focus dependent orfalseotherwise- See Also:
-
isArityUnbounded
default boolean isArityUnbounded()Determines if the final argument can be repeated.- Returns:
trueif the final argument can be repeated orfalseotherwise- See Also:
-
getResult
Retrieve the function result sequence type.- Returns:
- the function result sequence type
-
isNamedFunction
boolean isNamedFunction()Determine if the function is a named function.- Returns:
trueif the function is named orfalseif the function is anonymous
-
deepEquals
Description copied from interface:ICollectionValueDetermine if this and the other value are deeply equal.Item equality is defined by the XPath 3.1 fn:deep-equal specification.
- Specified by:
deepEqualsin interfaceICollectionValue- Parameters:
other- the other value to compare to this value todynamicContext- used to provide evaluation information, including the implicit timezone- Returns:
- the
trueif the two values are equal, orfalseotherwise
-
execute
@NonNull ISequence<?> execute(@NonNull List<? extends ISequence<?>> arguments, @NonNull DynamicContext dynamicContext, @NonNull ISequence<?> focus) Execute the function with the providedarguments, using the providedDynamicContextandfocus.- Parameters:
arguments- the function arguments or an empty list if there are no argumentsdynamicContext- the dynamic evaluation contextfocus- the current focus or an empty sequence if there is no focus- Returns:
- the function result
- Throws:
MetapathException- if an error occurred while executing the function
-
toAtomicItem
Description copied from interface:IItemGet the atomic value for the item. This may be the same item if the item is an instance ofIAnyAtomicItem.An implementation of item atomization.
- Specified by:
toAtomicItemin interfaceIItem- Returns:
- the atomic value or
nullif the item has no available value
-
toSignature
Get the signature of the function as a string.- Specified by:
toSignaturein interfaceICollectionValue- Returns:
- the signature
-
builder
Construct a new function signature builder.- Returns:
- the new builder instance
-
builder
Construct a new function signature builder.- Parameters:
staticContext- the static context used to lookup data types and function implementations- Returns:
- the new builder instance
-