## net.sf.saxon.value
Class DerivedAtomicValue

    java.lang.Object
      |
      +--net.sf.saxon.value.Value
            |
            +--net.sf.saxon.value.AtomicValue
                  |
                  +--net.sf.saxon.value.DerivedAtomicValue

All Implemented Interfaces:
  Expression, Item, java.io.Serializable

public class DerivedAtomicValue
extends AtomicValue

A DerivedAtomicValue is an atomic value of a user-defined type

See Also:
  Serialized Form

Field Summary

Fields inherited from interface net.sf.saxon.expr.Expression
`EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD`

Method Summary
`AtomicValue` `convert(int requiredType, XPathContext context)` Convert the value to a given type.
`java.lang.Object` `convertToJava(java.lang.Class target, Configuration config, XPathContext context)` Convert to Java object (for passing to external functions)
`boolean` `effectiveBooleanValue(XPathContext context)` Get the effective boolean value of the value
`boolean` `equals(java.lang.Object obj)` Determine if this value is equal to another value
`Item` `evaluateItem(XPathContext context)` Evaluate the value (this simply returns the value unchanged)
`ItemType` `getItemType()` Get the item type of this atomic value
`AtomicValue` `getPrimitiveValue()` Get the primitive value (the value in the value space)
`java.lang.String` `getStringValue()` Evaluate as a string
`int` `hashCode()` Generate a hash code to support equality testing
`static DerivedAtomicValue` `makeValue(AtomicValue primValue, java.lang.String lexicalValue, AtomicType type, boolean throwError)` Create a value of a user-defined atomic type
`java.lang.String` `toString()` Generate a string representation suitable for error messages

Methods inherited from class net.sf.saxon.value.AtomicValue
`convert, display, evaluateAsString, getCardinality, getComponent, getImplementationMethod, getTypedValue, iterate, process`

Methods inherited from class net.sf.saxon.value.Value
`analyze, asItem, asValue, collapseWhitespace, convertJavaObjectToXPath, getDependencies, getParentExpression, getSpecialProperties, inverse, iterateSubExpressions, normalizeWhitespace, promote, simplify, stringToNumber, trimWhitespace`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Method Detail

### makeValue

    public static DerivedAtomicValue makeValue(AtomicValue primValue,
                                               java.lang.String lexicalValue,
                                               AtomicType type,
                                               boolean throwError)
                                        throws XPathException

  Create a value of a user-defined atomic type

  Parameters:
    `primValue` - the value in the value space of the primitive type
    `lexicalValue` - the value in the lexical space. If null, the string value of primValue is used. This value is checked against the pattern facet (if any)
    `type` - the required atomic type
    `throwError` - true if an exception is to be thrown when the value is invalid (if false, the method returns null instead)
  Throws:
    `XPathException` - if the value is invalid

### getPrimitiveValue

    public AtomicValue getPrimitiveValue()

  Get the primitive value (the value in the value space)

  Overrides:
    `getPrimitiveValue` in class `AtomicValue`

### convert

    public AtomicValue convert(int requiredType,
                               XPathContext context)
                        throws XPathException

  Convert the value to a given type. The result of the conversion will be an atomic value of the required type.

  Specified by:
    `convert` in class `AtomicValue`
  Parameters:
    `requiredType` - type code of the required atomic type
    `context` - the evaluation context. Used primarily for error reporting, since nearly all type conversions are context-independent. The value may be null if the context is not known.
  Returns:
    the result of the conversion, if conversion was possible. This will always be an instance of the class corresponding to the type of value requested
  Throws:
    `XPathException` - if conversion is not allowed for this required type, or if the particular value cannot be converted

### evaluateItem

    public Item evaluateItem(XPathContext context)
                      throws XPathException

  Evaluate the value (this simply returns the value unchanged)

  Specified by:
    `evaluateItem` in interface `Expression`
  Overrides:
    `evaluateItem` in class `AtomicValue`
  Parameters:
    `context` - the evaluation context (not used in this implementation)
  Returns:
    the value, unchanged
  Throws:
    `XPathException`

### getStringValue

    public java.lang.String getStringValue()

  Evaluate as a string

  Specified by:
    `getStringValue` in interface `Item`
  Specified by:
    `getStringValue` in class `AtomicValue`
  Returns:
    the string value of the item

### effectiveBooleanValue

    public boolean effectiveBooleanValue(XPathContext context)

  Get the effective boolean value of the value

  Specified by:
    `effectiveBooleanValue` in interface `Expression`
  Overrides:
    `effectiveBooleanValue` in class `AtomicValue`
  Parameters:
    `context` - the evaluation context (not used in this implementation)
  Returns:
    true, unless the value is boolean false, numeric zero, or zero-length string

### convertToJava

    public java.lang.Object convertToJava(java.lang.Class target,
                                          Configuration config,
                                          XPathContext context)
                                   throws XPathException

  Description copied from class: `AtomicValue`
  Convert to Java object (for passing to external functions)

  Overrides:
    `convertToJava` in class `AtomicValue`
  Parameters:
    `target` - The class required by the external function
    `config` - The configuration (needed for access to schema information)
  Returns:
    an object of the target class
    `XPathException`

### getItemType

    public ItemType getItemType()

  Get the item type of this atomic value

  Returns:
    the item type

### hashCode

    public int hashCode()

  Generate a hash code to support equality testing

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    the hash code of the primitive base value

### equals

    public boolean equals(java.lang.Object obj)

  Determine if this value is equal to another value

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `obj` - the other value to be compared
  Returns:
    true if the values are equal according to the XPath rules

### toString

    public java.lang.String toString()

  Generate a string representation suitable for error messages

  Overrides:
    `toString` in class `AtomicValue`
  Returns:
    the string representation for the primitive base type