public class XQueryFunction extends java.lang.Object implements InstructionInfo, Declaration
Constructor and Description |
---|
XQueryFunction()
Create an XQuery function
|
Modifier and Type | Method and Description |
---|---|
void |
addArgument(UserFunctionParameter argument)
Add an argument to the list of arguments
|
void |
checkReferences(ExpressionVisitor visitor)
Type-check references to this function
|
void |
compile()
Compile this function to create a run-time definition that can be interpreted (note, this
has nothing to do with Java code generation)
|
void |
explain(ExpressionPresenter out)
Produce diagnostic output showing the compiled and optimized expression tree for a function
|
void |
fixupReferences()
Fix up references to this function
|
AnnotationList |
getAnnotations()
Get the annotations defined on this function
|
SequenceType[] |
getArgumentTypes()
Get the declared types of the arguments of this function
|
Expression |
getBody()
Get the body of the function
|
int |
getColumnNumber()
Return the column number
|
int |
getConstructType()
Get the type of construct.
|
java.lang.String |
getDisplayName()
Get the name of the function for display in error messages
|
StructuredQName |
getFunctionName()
Get the name of the function as a structured QName
|
int |
getHostLanguage()
Get the host language (XSLT, XQuery, XPath) used to implement the code in this container
|
SymbolicName |
getIdentificationKey()
Get an identifying key for this function, which incorporates the URI and local part of the
function name plus the arity
|
static SymbolicName |
getIdentificationKey(StructuredQName qName,
int arity)
Construct what the identification key would be for a function with given URI, local name, and arity
|
int |
getLineNumber()
Get the line number of the instruction in the source stylesheet module.
|
NamespaceResolver |
getNamespaceResolver()
Get the namespace context of the instruction.
|
int |
getNumberOfArguments()
Get the arity of the function
|
StructuredQName |
getObjectName()
Get a name identifying the object of the expression, for example a function name, template name,
variable name, key name, element name, etc.
|
PackageData |
getPackageData()
Get data about the unit of compilation (XQuery module, XSLT package) to which this
container belongs
|
UserFunctionParameter[] |
getParameterDefinitions()
Get the definitions of the arguments to this function
|
java.util.Iterator<java.lang.String> |
getProperties()
Get an iterator over all the properties available.
|
java.lang.Object |
getProperty(java.lang.String name)
Get the value of a particular property of the instruction.
|
java.lang.String |
getPublicId()
Return the public identifier for the current document event.
|
SequenceType |
getResultType()
Get the result type of the function
|
StaticContext |
getStaticContext()
Get the static context for this function
|
java.lang.String |
getSystemId()
Get the system identifier (URI) of the source module containing
the instruction.
|
UserFunction |
getUserFunction()
Get the callable compiled function contained within this XQueryFunction definition.
|
boolean |
hasAnnotation(StructuredQName name)
Ask whether the function has an annotation with a particular name
|
boolean |
isMemoFunction()
Find out whether this is a memo function
|
boolean |
isPrivate()
Ask whether this is a private function (as defined in XQuery 3.0)
|
boolean |
isUpdating()
Ask whether this is an updating function (as defined in XQuery Update)
|
void |
optimize()
Optimize the body of this function
|
void |
registerReference(UserFunctionResolvable ufc)
Register a call on this function
|
Location |
saveLocation()
Get an immutable copy of this Location object.
|
void |
setAnnotations(AnnotationList annotations)
Set the annotations on this function
|
void |
setBody(Expression body)
Set the body of the function
|
void |
setFunctionName(StructuredQName name)
Set the name of the function
|
void |
setLocation(Location location)
Set the location of the source declaration of the function
|
void |
setMemoFunction(boolean isMemoFunction)
Set that this is, or is not, a memo function.
|
void |
setResultType(SequenceType resultType)
Set the required result type of the function
|
void |
setStaticContext(QueryModule env)
Set the static context for this function
|
void |
setUpdating(boolean isUpdating)
Set whether this is an updating function (as defined in XQuery Update)
|
public PackageData getPackageData()
public void setFunctionName(StructuredQName name)
name
- the name of the function as a StructuredQName objectpublic void addArgument(UserFunctionParameter argument)
argument
- the formal declaration of the argument to be addedpublic void setResultType(SequenceType resultType)
resultType
- the declared result type of the functionpublic void setBody(Expression body)
body
- the expression forming the body of the functionpublic Expression getBody()
public void setLocation(Location location)
location
- the source locationpublic StructuredQName getFunctionName()
public java.lang.String getDisplayName()
public SymbolicName getIdentificationKey()
public static SymbolicName getIdentificationKey(StructuredQName qName, int arity)
qName
- the name of the functionarity
- the number of argumentspublic SequenceType getResultType()
public void setStaticContext(QueryModule env)
env
- the static context for the module in which the function is declaredpublic StaticContext getStaticContext()
public SequenceType[] getArgumentTypes()
public UserFunctionParameter[] getParameterDefinitions()
public int getNumberOfArguments()
public void registerReference(UserFunctionResolvable ufc)
ufc
- a user function call that references this function.public void setMemoFunction(boolean isMemoFunction)
isMemoFunction
- true if this is a memo function.public boolean isMemoFunction()
public void setUpdating(boolean isUpdating)
isUpdating
- true if this is an updating functionpublic boolean isUpdating()
public void setAnnotations(AnnotationList annotations)
annotations
- the annotations, indexed by annotation namepublic AnnotationList getAnnotations()
public boolean hasAnnotation(StructuredQName name)
name
- the name of the required annotationpublic boolean isPrivate()
public void compile() throws XPathException
XPathException
- if errors are foundpublic void optimize() throws XPathException
XPathException
- if execution fails, for example because the function is updating
and contains constructs not allowed in an updating function, or vice-versa.public void fixupReferences()
public void checkReferences(ExpressionVisitor visitor) throws XPathException
visitor
- the expression visitorXPathException
public void explain(ExpressionPresenter out) throws XPathException
out
- the destination to be usedXPathException
public UserFunction getUserFunction()
public int getConstructType()
LocationKind
.getConstructType
in interface InstructionInfo
public StructuredQName getObjectName()
getObjectName
in interface InstructionInfo
public java.lang.String getSystemId()
getSystemId
in interface javax.xml.transform.SourceLocator
getSystemId
in interface Location
getSystemId
in interface org.xml.sax.Locator
public int getLineNumber()
getLineNumber
in interface javax.xml.transform.SourceLocator
getLineNumber
in interface Location
getLineNumber
in interface org.xml.sax.Locator
public java.lang.String getPublicId()
getPublicId
in interface javax.xml.transform.SourceLocator
getPublicId
in interface Location
getPublicId
in interface org.xml.sax.Locator
getSystemId()
public int getColumnNumber()
getColumnNumber
in interface javax.xml.transform.SourceLocator
getColumnNumber
in interface Location
getColumnNumber
in interface org.xml.sax.Locator
getLineNumber()
public Location saveLocation()
saveLocation
in interface Location
public NamespaceResolver getNamespaceResolver()
public java.lang.Object getProperty(java.lang.String name)
getProperty
in interface InstructionInfo
name
- The name of the required propertypublic java.util.Iterator<java.lang.String> getProperties()
getProperties
in interface InstructionInfo
public int getHostLanguage()
Configuration.XSLT
or Configuration.XQUERY
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.