net.sf.saxon.instruct
Class UserFunction

java.lang.Object
  extended bynet.sf.saxon.instruct.UserFunction
All Implemented Interfaces:
CallableFunction, InstructionInfo, Serializable, SourceLocator

public final class UserFunction
extends Object
implements CallableFunction, Serializable, InstructionInfo, SourceLocator

This object represents the compiled form of a user-written function (the source can be either an XSLT stylesheet function or an XQuery function).

It is assumed that type-checking, of both the arguments and the results, has been handled at compile time. That is, the expression supplied as the body of the function must be wrapped in code to check or convert the result to the required type, and calls on the function must be wrapped at compile time to check or convert the supplied arguments.

See Also:
Serialized Form

Constructor Summary
UserFunction(Expression body)
           
 
Method Summary
 Value call(Value[] actualArgs, Controller controller)
          Call this function
 int getColumnNumber()
           
 String getFunctionName()
           
 String getInstructionName()
          Get the name of the instruction.
 int getLineNumber()
          Get the line number of the instruction in the source stylesheet module.
 HashMap getProperties()
          Get all the properties of the instruction.
 Object getProperty(String propertyName)
          Get the value of a particular property of the instruction.
 String getPublicId()
           
 String getSystemId()
          Get the system identifier (URI) of the source stylesheet module containing the instruction.
 void setFunctionName(String name)
           
 void setLineNumber(int lineNumber)
           
 void setMemoFunction(boolean isMemo)
           
 void setSystemId(String systemId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserFunction

public UserFunction(Expression body)
Method Detail

setLineNumber

public void setLineNumber(int lineNumber)

setSystemId

public void setSystemId(String systemId)

getLineNumber

public int getLineNumber()
Description copied from interface: InstructionInfo
Get the line number of the instruction in the source stylesheet module. If this is not known, or if the instruction is an artificial one that does not relate to anything in the source code, the value returned may be -1.

Specified by:
getLineNumber in interface InstructionInfo

getSystemId

public String getSystemId()
Description copied from interface: InstructionInfo
Get the system identifier (URI) of the source stylesheet module containing the instruction. This will generally be an absolute URI. If the system identifier is not known, the method may return null. In some cases, for example where XML external entities are used, the correct system identifier is not always retained.

Specified by:
getSystemId in interface InstructionInfo

getColumnNumber

public int getColumnNumber()
Specified by:
getColumnNumber in interface SourceLocator

getPublicId

public String getPublicId()
Specified by:
getPublicId in interface SourceLocator

getInstructionName

public String getInstructionName()
Description copied from interface: InstructionInfo
Get the name of the instruction. This will normally be the name of an XSLT instruction, a literal result element, or an extension element. The name is passed in a form suitable for display to the user: it will generally be a QName, but this is not guaranteed. Some instructions may be internally generated by the Saxon compiler, in which case the name might not relate to anything obvious in the source stylesheet

Specified by:
getInstructionName in interface InstructionInfo

getProperty

public Object getProperty(String propertyName)
Description copied from interface: InstructionInfo
Get the value of a particular property of the instruction. Properties of XSLT instructions are generally known by the name of the stylesheet attribute that defines them.

Specified by:
getProperty in interface InstructionInfo
Parameters:
propertyName - The name of the required property
Returns:
The value of the requested property, or null if the property is not available

getProperties

public HashMap getProperties()
Description copied from interface: InstructionInfo
Get all the properties of the instruction. Properties of XSLT instructions are generally known by the name of the stylesheet attribute that defines them.

Specified by:
getProperties in interface InstructionInfo
Returns:
a HashMap containing all the properties of this instruction.

setMemoFunction

public void setMemoFunction(boolean isMemo)

setFunctionName

public void setFunctionName(String name)

getFunctionName

public String getFunctionName()
Specified by:
getFunctionName in interface CallableFunction

call

public Value call(Value[] actualArgs,
                  Controller controller)
           throws TransformerException
Call this function

Specified by:
call in interface CallableFunction
Throws:
TransformerException