Package net.sf.saxon.expr.instruct
Class UserFunctionParameter
java.lang.Object
net.sf.saxon.expr.instruct.UserFunctionParameter
- All Implemented Interfaces:
Binding
,LocalBinding
Run-time object representing a formal argument to a user-defined function
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addReference
(VariableReference ref, boolean isLoopingReference) Register a variable reference that refers to the variable bound in this expressionevaluateVariable
(XPathContext context) Evaluate this function parameterGet the expression used to compute the default value of the parameterIf this is the first argument of a streamable stylesheet function, get the streamability category; otherwise returnFunctionStreamability.UNCLASSIFIED
If the variable is bound to an integer, get the minimum and maximum possible values.int
If this is a local variable held on the local stack frame, return the corresponding slot number.int
Get the (nominal) number of references within the function body to this parameter, where a reference inside a loop is counted as multiple referencesGet the required type of this function parameterGet the name of this parameterfinal boolean
Test whether it is permitted to assign to the variable using the saxon:assign extension element.final boolean
isGlobal()
Indicate whether the binding is local or global.boolean
Ask whether this parameter requires support for indexingfinal boolean
Ask whether the parameter is a required parametersvoid
setDefaultValueExpression
(Expression select) Set an expression used to compute the default value of the parametervoid
If this is the first argument of a streamable stylesheet function, set the streamability categoryvoid
Say that the bound value has the potential to be indexedvoid
setIndexedVariable
(boolean indexed) Indicate that this parameter requires (or does not require) support for indexingvoid
setRequired
(boolean required) Say whether the parameter is a required parametervoid
setRequiredType
(SequenceType type) Set the required type of this function parametervoid
setSlotNumber
(int slot) Set the slot number to be used by this parametervoid
Set the name of this parameter
-
Constructor Details
-
UserFunctionParameter
public UserFunctionParameter()Create a UserFunctionParameter
-
-
Method Details
-
isGlobal
public final boolean isGlobal()Indicate whether the binding is local or global. A global binding is one that has a fixed value for the life of a query or transformation; any other binding is local. -
isAssignable
public final boolean isAssignable()Test whether it is permitted to assign to the variable using the saxon:assign extension element. This will only be for an XSLT global variable where the extra attribute saxon:assignable="yes" is present.- Specified by:
isAssignable
in interfaceBinding
- Returns:
- false (always)
-
setRequired
public void setRequired(boolean required) Say whether the parameter is a required parameter- Parameters:
required
- true of the parameter is required, false if optional
-
isRequired
public final boolean isRequired()Ask whether the parameter is a required parameters- Returns:
- true of the parameter is required, false if optional
-
setSlotNumber
public void setSlotNumber(int slot) Set the slot number to be used by this parameter- Parameters:
slot
- the slot number, that is, the position of the parameter value within the local stack frame
-
getLocalSlotNumber
public int getLocalSlotNumber()If this is a local variable held on the local stack frame, return the corresponding slot number. In other cases, return -1.- Specified by:
getLocalSlotNumber
in interfaceLocalBinding
- Returns:
- the slot number, indicating the position of the parameter on the local stack frame
-
setRequiredType
Set the required type of this function parameter- Parameters:
type
- the declared type of the parameter
-
getRequiredType
Get the required type of this function parameter- Specified by:
getRequiredType
in interfaceBinding
- Returns:
- the declared type of the parameter
-
getIntegerBoundsForVariable
If the variable is bound to an integer, get the minimum and maximum possible values. Return null if unknown or not applicable- Specified by:
getIntegerBoundsForVariable
in interfaceBinding
- Returns:
- a pair of integers containing the minimum and maximum values for the integer value; or null if the value is not an integer or the range is unknown
-
setVariableQName
Set the name of this parameter- Parameters:
name
- the name of the parameter
-
getVariableQName
Get the name of this parameter- Specified by:
getVariableQName
in interfaceBinding
- Returns:
- the name of this parameter
-
addReference
Description copied from interface:Binding
Register a variable reference that refers to the variable bound in this expression- Specified by:
addReference
in interfaceBinding
- Parameters:
ref
- the variable referenceisLoopingReference
- - true if the reference occurs within a loop, such as the predicate of a filter expression
-
setDefaultValueExpression
Set an expression used to compute the default value of the parameter- Parameters:
select
- the default value expression
-
getDefaultValueExpression
Get the expression used to compute the default value of the parameter- Returns:
- the default value expression, if there is one, otherwise null
-
getReferenceCount
public int getReferenceCount()Get the (nominal) number of references within the function body to this parameter, where a reference inside a loop is counted as multiple references- Returns:
- the nominal number of references
-
setIndexedVariable
public void setIndexedVariable(boolean indexed) Indicate that this parameter requires (or does not require) support for indexing- Parameters:
indexed
- true if support for indexing is required. This will be set if the parameter is used in a filter expression such as $param[@a = 17]
-
setIndexedVariable
public void setIndexedVariable()Description copied from interface:LocalBinding
Say that the bound value has the potential to be indexed- Specified by:
setIndexedVariable
in interfaceLocalBinding
-
isIndexedVariable
public boolean isIndexedVariable()Ask whether this parameter requires support for indexing- Specified by:
isIndexedVariable
in interfaceLocalBinding
- Returns:
- true if support for indexing is required. This will be set if the parameter is used in a filter expression such as $param[@a = 17]
-
evaluateVariable
Evaluate this function parameter- Specified by:
evaluateVariable
in interfaceBinding
- Parameters:
context
- the XPath dynamic context- Returns:
- the value of the parameter
-
setFunctionStreamability
If this is the first argument of a streamable stylesheet function, set the streamability category- Parameters:
ability
- the streamability category
-
getFunctionStreamability
If this is the first argument of a streamable stylesheet function, get the streamability category; otherwise returnFunctionStreamability.UNCLASSIFIED
- Returns:
- the streamability category
-