net.sf.saxon.value
Class RestrictedStringValue

java.lang.Object
  extended bynet.sf.saxon.value.Value
      extended bynet.sf.saxon.value.AtomicValue
          extended bynet.sf.saxon.value.StringValue
              extended bynet.sf.saxon.value.RestrictedStringValue
All Implemented Interfaces:
Expression, Item, java.io.Serializable, ValueRepresentation

public final class RestrictedStringValue
extends StringValue

A value conforming to one of the built-in subtypes of String, specifically normalizedString, token, language, Name, NCName, ID, IDREF, ENTITY, NMTOKEN. This class doesnt' handle the types derived by list: IDREFS, NMTOKENS, ENTITIES.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class net.sf.saxon.value.StringValue
StringValue.CharacterIterator
 
Field Summary
 
Fields inherited from class net.sf.saxon.value.StringValue
EMPTY_STRING, length, SINGLE_SPACE, value
 
Fields inherited from interface net.sf.saxon.expr.Expression
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
 
Constructor Summary
RestrictedStringValue()
           
 
Method Summary
 AtomicValue convertPrimitive(BuiltInAtomicType requiredType, boolean validate)
          Convert to target data type
 ItemType getItemType()
          Return the type of the expression
static AtomicValue makeRestrictedString(java.lang.CharSequence value, int type, boolean validate)
          Factory method to create a restricted string value from a string
 java.lang.String toString()
          Get string value.
 
Methods inherited from class net.sf.saxon.value.StringValue
convertToJava, effectiveBooleanValue, equals, expand, getStringLength, getStringLength, getStringValue, getStringValueCS, hashCode, iterateCharacters
 
Methods inherited from class net.sf.saxon.value.AtomicValue
checkPermittedContents, convert, convert, display, evaluateAsString, evaluateItem, getCardinality, getComponent, getImplementationMethod, getLength, getPrimitiveValue, getTypedValue, hasBuiltInType, iterate, process
 
Methods inherited from class net.sf.saxon.value.Value
analyze, asItem, asValue, collapseWhitespace, convert, convertJavaObjectToXPath, getDependencies, getIterator, getParentExpression, getSpecialProperties, itemAt, iterateSubExpressions, makeQNameValue, normalizeWhitespace, promote, simplify, stringToNumber, trimWhitespace
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RestrictedStringValue

public RestrictedStringValue()
Method Detail

makeRestrictedString

public static AtomicValue makeRestrictedString(java.lang.CharSequence value,
                                               int type,
                                               boolean validate)
Factory method to create a restricted string value from a string

Parameters:
value - the String value. Null is taken as equivalent to "".
validate - true if validation is required, false if the caller already knows that the value is valid
Returns:
either the required RestrictedStringValue if the value is valid, or an ErrorValue encapsulating the error message if not.

getItemType

public ItemType getItemType()
Return the type of the expression

Specified by:
getItemType in interface Expression
Overrides:
getItemType in class StringValue
Returns:
Type.STRING (always)

convertPrimitive

public AtomicValue convertPrimitive(BuiltInAtomicType requiredType,
                                    boolean validate)
Convert to target data type

Overrides:
convertPrimitive in class StringValue
Parameters:
requiredType - an integer identifying the required atomic type
validate - true if validation is required. If set to false, the caller guarantees that the value is valid for the target data type, and that further validation is therefore not required. Note that a validation failure may be reported even if validation was not requested.
Returns:
an AtomicValue, a value of the required type; or an ErrorValue

toString

public java.lang.String toString()
Description copied from class: AtomicValue
Get string value. In general toString() for an atomic value displays the value as it would be written in XPath: that is, as a literal if available, or as a call on a constructor function otherwise.

Overrides:
toString in class StringValue