Package com.icl.saxon.expr
Class StringValue
- java.lang.Object
-
- com.icl.saxon.expr.Expression
-
- com.icl.saxon.expr.Value
-
- com.icl.saxon.expr.StringValue
-
public final class StringValue extends Value
A string value
-
-
Field Summary
-
Fields inherited from class com.icl.saxon.expr.Expression
staticContext
-
-
Constructor Summary
Constructors Constructor Description StringValue(java.lang.String value)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
asBoolean()
Convert the string value to a booleandouble
asNumber()
Convert the string value to a numberjava.lang.String
asString()
Get the string value as a Stringint
conversionPreference(java.lang.Class required)
Get conversion preference for this value to a Java class.java.lang.Object
convertToJava(java.lang.Class target)
Convert to Java object (for passing to external functions)void
display(int level)
Diagnostic print of expression structureboolean
equals(StringValue other)
Determine if two StringValues are equalstatic int[]
expand(java.lang.String s)
Expand a string containing surrogate pairs into an array of 32-bit charactersint
getDataType()
Return the type of the expression (if known)int
getLength()
Get the length of this string, as defined in XPath.static int
getLength(java.lang.String s)
Get the length of a string, as defined in XPath.-
Methods inherited from class com.icl.saxon.expr.Value
compare, equals, evaluate, getDependencies, inverse, notEquals, numericCompare, reduce, simplify, stringToNumber
-
Methods inherited from class com.icl.saxon.expr.Expression
containsReferences, enumerate, evaluateAsBoolean, evaluateAsNodeSet, evaluateAsNumber, evaluateAsString, getStaticContext, indent, isContextDocumentNodeSet, make, outputStringValue, setStaticContext, usesCurrent
-
-
-
-
Method Detail
-
asString
public java.lang.String asString()
Get the string value as a String
-
asNumber
public double asNumber()
Convert the string value to a number
-
asBoolean
public boolean asBoolean()
Convert the string value to a boolean
-
getDataType
public int getDataType()
Return the type of the expression (if known)- Specified by:
getDataType
in classExpression
- Returns:
- Value.STRING (always)
-
getLength
public int getLength()
Get the length of this string, as defined in XPath. This is not the same as the Java length, as a Unicode surrogate pair counts as a single character
-
getLength
public static int getLength(java.lang.String s)
Get the length of a string, as defined in XPath. This is not the same as the Java length, as a Unicode surrogate pair counts as a single character.- Parameters:
s
- The string whose length is required
-
expand
public static int[] expand(java.lang.String s)
Expand a string containing surrogate pairs into an array of 32-bit characters
-
equals
public boolean equals(StringValue other)
Determine if two StringValues are equal
-
conversionPreference
public int conversionPreference(java.lang.Class required)
Get conversion preference for this value to a Java class. A low result indicates higher preference.- Specified by:
conversionPreference
in classValue
-
convertToJava
public java.lang.Object convertToJava(java.lang.Class target) throws XPathException
Convert to Java object (for passing to external functions)- Specified by:
convertToJava
in classValue
- Parameters:
target
- The class required by the external function- Returns:
- an object of the target class
- Throws:
XPathException
-
display
public void display(int level)
Diagnostic print of expression structure- Specified by:
display
in classExpression
-
-