|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.lib.ExtensionFunctionDefinition
public abstract class ExtensionFunctionDefinition
This abstract class is provided to allow user-written extension functions to be implemented with the full capabilities of functions that are an intrinsic part of the Saxon product. In particular, the class has the opportunity to save data from the static context and to optimize itself at compile time.
There should be one class implementing this interface for each function name; if there are several functions with the same name but different arity, the same class should implement them all.
Note that an IntegratedFunction is trusted; calls are allowed even if the configuration option
FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS
is false. In cases where an IntegratedFunction
is used to load and execute untrusted code, it should check this configuration option before doing so.
Constructor Summary | |
---|---|
ExtensionFunctionDefinition()
|
Method Summary | |
---|---|
boolean |
dependsOnFocus()
Ask whether the result of the function depends on the focus, or on other variable parts of the context. |
abstract SequenceType[] |
getArgumentTypes()
Get the required types for the arguments of this function. |
abstract StructuredQName |
getFunctionQName()
Get the name of the function, as a QName. |
int |
getMaximumNumberOfArguments()
Get the maximum number of arguments allowed by the function. |
int |
getMinimumNumberOfArguments()
Get the minimum number of arguments required by the function |
abstract SequenceType |
getResultType(SequenceType[] suppliedArgumentTypes)
Get the type of the result of the function |
boolean |
hasSideEffects()
Ask whether the function has side-effects. |
abstract ExtensionFunctionCall |
makeCallExpression()
Create a call on this function. |
boolean |
trustResultType()
Ask whether the result actually returned by the function can be trusted, or whether it should be checked against the declared type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExtensionFunctionDefinition()
Method Detail |
---|
public abstract StructuredQName getFunctionQName()
This method must be implemented in all subclasses
public int getMinimumNumberOfArguments()
The default implementation returns the number of items in the result of calling
getArgumentTypes()
public int getMaximumNumberOfArguments()
The default implementation returns the value of getMinimumNumberOfArguments()
public abstract SequenceType[] getArgumentTypes()
This method must be implemented in all subtypes.
getMaximumNumberOfArguments()
; however for functions
that allow a variable number of arguments, the array can be smaller than this, with the last
entry in the array providing the required type for all the remaining arguments.public abstract SequenceType getResultType(SequenceType[] suppliedArgumentTypes)
This method must be implemented in all subtypes.
suppliedArgumentTypes
- the static types of the supplied arguments to the function.
This is provided so that a more precise result type can be returned in the common
case where the type of the result depends on the types of the arguments.
public boolean trustResultType()
public boolean dependsOnFocus()
The default implementation returns false.
The method must return true if the function makes use of any of these values from the dynamic context. Returning true inhibits certain optimizations, such as moving the function call out of the body of an xsl:for-each loop, or extracting it into a global variable.
public boolean hasSideEffects()
public abstract ExtensionFunctionCall makeCallExpression()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |