Package org.apache.xmlbeans.impl.values

## Class XmlUnionImpl

- java.lang.Object
- - org.apache.xmlbeans.impl.values.XmlObjectBase
  - - org.apache.xmlbeans.impl.values.XmlUnionImpl

- All Implemented Interfaces:
    `Serializable`, `TypeStoreUser`, `SimpleValue`, `XmlAnySimpleType`, `XmlObject`, `XmlTokenSource`
  Direct Known Subclasses:
    `AllImpl.MaxOccursImpl`, `AllNNIImpl`, `BlockSetImpl`, `DerivationSetImpl`, `FullDerivationSetImpl`, `JavaNameListImpl`, `LangAttributeImpl.LangImpl`, `NamespaceListImpl`, `NamespaceListImpl`, `NamespaceListImpl.MemberImpl2.ItemImpl`, `NamespaceListImpl.MemberImpl2.ItemImpl`, `NarrowMaxMinImpl.MaxOccursImpl`, `SimpleDerivationSetImpl`

      public class XmlUnionImpl
      extends XmlObjectBase
      implements XmlAnySimpleType

  This class implements simple union types.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.apache.xmlbeans.impl.values.XmlObjectBase

      `_voorVc, KIND_SETTERHELPER_ARRAYITEM, KIND_SETTERHELPER_SINGLETON, MAJOR_VERSION_NUMBER, MINOR_VERSION_NUMBER`

    - ### Fields inherited from interface org.apache.xmlbeans.XmlAnySimpleType

      `Factory, type`

    - ### Fields inherited from interface org.apache.xmlbeans.XmlObject

      `EQUAL, Factory, GREATER_THAN, LESS_THAN, NOT_EQUAL, type`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `XmlUnionImpl​(SchemaType type, boolean complex)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected String` | `compute_text​(NamespaceManager nsm)` | This should return the canonical string value of the primitive.
    `protected boolean` | `equal_to​(XmlObject xmlobj)` |
    `protected int` | `get_wscanon_rule()` | Returns the whitespace rule that will be applied before building a string to pass to get_text().
    `BigDecimal` | `getBigDecimalValue()` | Returns the value as a `BigDecimal`.
    `BigInteger` | `getBigIntegerValue()` | Returns the value as a `BigInteger`.
    `boolean` | `getBooleanValue()` | Returns the value as a boolean.
    `byte[]` | `getByteArrayValue()` | Returns the value as a byte array.
    `byte` | `getByteValue()` | Returns the value as a byte.
    `Calendar` | `getCalendarValue()` | Returns the value as a `Calendar`.
    `Date` | `getDateValue()` | Returns the value as a `Date`.
    `double` | `getDoubleValue()` | Returns the value as a double.
    `StringEnumAbstractBase` | `getEnumValue()` | Returns the value as a `StringEnumAbstractBase`.
    `float` | `getFloatValue()` | Returns the value as a float.
    `GDate` | `getGDateValue()` | Returns the value as a `GDate`.
    `GDuration` | `getGDurationValue()` | Returns the value as a `GDuration`.
    `int` | `getIntValue()` | Returns the value as an int.
    `List<?>` | `getListValue()` | Returns the value as a `List` of friendly Java objects (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration).
    `long` | `getLongValue()` | Returns the value as a long.
    `QName` | `getQNameValue()` | Returns the value as a `QName`.
    `short` | `getShortValue()` | Returns the value as a short.
    `String` | `getStringValue()` | Returns the value as a `String`.
    `SchemaType` | `instanceType()` | The same as getSchemaType unless this is a union instance or nil value.
    `protected boolean` | `is_defaultable_ws​(String v)` | Types should return false if they don't treat the given whitespace as a default value.
    `SchemaType` | `schemaType()` |
    `protected void` | `set_b64​(byte[] b)` |
    `protected void` | `set_BigDecimal​(BigDecimal v)` |
    `protected void` | `set_BigInteger​(BigInteger v)` |
    `protected void` | `set_boolean​(boolean v)` |
    `protected void` | `set_byte​(byte v)` |
    `protected void` | `set_ByteArray​(byte[] b)` |
    `protected void` | `set_Calendar​(Calendar c)` |
    `protected void` | `set_Date​(Date d)` |
    `protected void` | `set_double​(double v)` |
    `protected void` | `set_enum​(StringEnumAbstractBase e)` |
    `protected void` | `set_float​(float v)` |
    `protected void` | `set_GDate​(GDateSpecification d)` |
    `protected void` | `set_GDuration​(GDurationSpecification d)` |
    `protected void` | `set_hex​(byte[] b)` |
    `protected void` | `set_int​(int v)` |
    `protected void` | `set_list​(List<?> v)` |
    `protected void` | `set_long​(long v)` |
    `protected void` | `set_nil()` | This should clear the value, and set it to whatever is supposed to be returned when the value is nilled.
    `protected void` | `set_QName​(QName v)` |
    `protected void` | `set_short​(short v)` |
    `protected void` | `set_text​(String s)` | This should set the value of the type from text, or throw an XmlValueOutOfRangeException if it can't.
    `protected void` | `set_xmldate​(XmlObject v)` |
    `protected void` | `set_xmldatetime​(XmlObject v)` |
    `protected void` | `set_xmldecimal​(XmlObject v)` |
    `protected void` | `set_xmldouble​(XmlObject v)` |
    `protected void` | `set_xmlduration​(XmlObject v)` |
    `protected void` | `set_xmlfloat​(XmlObject v)` |
    `protected void` | `set_xmlgday​(XmlObject v)` |
    `protected void` | `set_xmlgmonth​(XmlObject v)` |
    `protected void` | `set_xmlgmonthday​(XmlObject v)` |
    `protected void` | `set_xmlgyear​(XmlObject v)` |
    `protected void` | `set_xmlgyearmonth​(XmlObject v)` |
    `protected void` | `set_xmltime​(XmlObject v)` |
    `protected void` | `validate_simpleval​(String lexical, ValidationContext ctx)` |
    `protected int` | `value_hash_code()` |
    `List<? extends XmlAnySimpleType>` | `xgetListValue()` | Returns the value as a `List` of XmlAnySimpleType objects.

    - ### Methods inherited from class org.apache.xmlbeans.impl.values.XmlObjectBase

      `_copy, _copy, _isComplexContent, _isComplexType, _set, _validateOnSet, attach_store, build_nil, build_text, changeType, check_dated, check_orphaned, compare_to, compareTo, compareValue, copy, copy, create_attribute_user, create_element_user, disconnect_store, documentProperties, dump, elementFlags, equals, execQuery, execQuery, generatedSetterHelperImpl, get_attribute_field, get_attribute_type, get_attributeflags, get_default_attribute_text, get_default_attribute_value, get_default_element_text, get_element_ending_delimiters, get_element_type, get_elementflags, get_schema_type, get_store, get_wscanon_text, getBooleanArray, getBooleanArray, getByteArray, getByteArray, getDomNode, getDoubleArray, getDoubleArray, getEnumArray, getEnumArray, getFloatArray, getFloatArray, getIntArray, getIntArray, getLongArray, getLongArray, getObjectArray, getObjectArray, getObjectValue, getShortArray, getShortArray, getXmlLocale, getXmlObjectArray, getXmlObjectArray, has_store, hashCode, init_flags, initComplexType, invalidate_element_order, invalidate_nilvalue, invalidate_value, is_child_element_order_sensitive, is_orphaned, isDefault, isDefaultable, isFixed, isImmutable, isInstanceOf, isNil, isNillable, java_value, monitor, new_visitor, newCursor, newCursorForce, newDomNode, newDomNode, newInputStream, newInputStream, newReader, newReader, newXMLStreamReader, newXMLStreamReader, save, save, save, save, save, save, save, save, selectAttribute, selectAttribute, selectAttributes, selectChildren, selectChildren, selectChildren, selectPath, selectPath, set, set_char, set_ComplexXml, set_newValue, set_notation, set_String, set_xmlanysimple, setBigDecimalValue, setBigIntegerValue, setBooleanValue, setByteArrayValue, setByteValue, setCalendarValue, setDateValue, setDoubleValue, setEnumValue, setFloatValue, setGDateValue, setGDateValue, setGDurationValue, setGDurationValue, setImmutable, setIntValue, setListValue, setLongValue, setNil, setObjectValue, setQNameValue, setShortValue, setStringValue, setValidateOnSet, substitute, toString, update_from_complex_content, uses_invalidate_value, validate, validate, validate_now, valueEquals, valueHashCode, writeReplace, xgetArray, xgetArray, xmlText, xmlText`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.xmlbeans.XmlAnySimpleType

      `setStringValue`

    - ### Methods inherited from interface org.apache.xmlbeans.XmlObject

      `changeType, compareTo, compareValue, copy, copy, execQuery, execQuery, isImmutable, isNil, selectAttribute, selectAttribute, selectAttributes, selectChildren, selectChildren, selectChildren, selectPath, selectPath, set, setNil, substitute, toString, validate, validate, valueEquals, valueHashCode`

    - ### Methods inherited from interface org.apache.xmlbeans.XmlTokenSource

      `documentProperties, dump, getDomNode, monitor, newCursor, newDomNode, newDomNode, newInputStream, newInputStream, newReader, newReader, newXMLStreamReader, newXMLStreamReader, save, save, save, save, save, save, save, save, xmlText, xmlText`

- - ### Constructor Detail

    - #### XmlUnionImpl

          public XmlUnionImpl​(SchemaType type,
                              boolean complex)

  - ### Method Detail

    - #### schemaType

          public SchemaType schemaType()

      Specified by:
        `schemaType` in interface `XmlObject`
      Specified by:
        `schemaType` in class `XmlObjectBase`
      Returns:
        The schema type for this instance. This is a permanent, unchanging property of the instance.

    - #### instanceType

          public SchemaType instanceType()

      Description copied from interface: `SimpleValue`
      The same as getSchemaType unless this is a union instance or nil value.

      For unions, this returns the non-union consituent type of this instance. This type may change if setters are called that cause the instance to change to another constituent type of the union.

      For nil values, this returns null.

      Specified by:
        `instanceType` in interface `SimpleValue`
      Overrides:
        `instanceType` in class `XmlObjectBase`

    - #### compute_text

          protected String compute_text​(NamespaceManager nsm)

      Description copied from class: `XmlObjectBase`
      This should return the canonical string value of the primitive. Only called when non-nil.
      Specified by:
        `compute_text` in class `XmlObjectBase`

    - #### is_defaultable_ws

          protected boolean is_defaultable_ws​(String v)

      Description copied from class: `XmlObjectBase`
      Types should return false if they don't treat the given whitespace as a default value.
      Overrides:
        `is_defaultable_ws` in class `XmlObjectBase`

    - #### set_text

          protected void set_text​(String s)

      Description copied from class: `XmlObjectBase`
      This should set the value of the type from text, or throw an XmlValueOutOfRangeException if it can't.
      Specified by:
        `set_text` in class `XmlObjectBase`

    - #### set_nil

          protected void set_nil()

      Description copied from class: `XmlObjectBase`
      This should clear the value, and set it to whatever is supposed to be returned when the value is nilled.
      Specified by:
        `set_nil` in class `XmlObjectBase`

    - #### get_wscanon_rule

          protected int get_wscanon_rule()

      Description copied from class: `XmlObjectBase`
      Returns the whitespace rule that will be applied before building a string to pass to get_text().

      Overridden by subclasses that don't need their text for set_text canonicalized; perhaps they already implement scanners that can deal with whitespace, and they know they have no regex pattern restrictions.

      Overrides:
        `get_wscanon_rule` in class `XmlObjectBase`

    - #### getFloatValue

          public float getFloatValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a float.
      Specified by:
        `getFloatValue` in interface `SimpleValue`
      Overrides:
        `getFloatValue` in class `XmlObjectBase`

    - #### getDoubleValue

          public double getDoubleValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a double.
      Specified by:
        `getDoubleValue` in interface `SimpleValue`
      Overrides:
        `getDoubleValue` in class `XmlObjectBase`

    - #### getBigDecimalValue

          public BigDecimal getBigDecimalValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a `BigDecimal`.
      Specified by:
        `getBigDecimalValue` in interface `SimpleValue`
      Overrides:
        `getBigDecimalValue` in class `XmlObjectBase`

    - #### getBigIntegerValue

          public BigInteger getBigIntegerValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a `BigInteger`.
      Specified by:
        `getBigIntegerValue` in interface `SimpleValue`
      Overrides:
        `getBigIntegerValue` in class `XmlObjectBase`

    - #### getByteValue

          public byte getByteValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a byte.
      Specified by:
        `getByteValue` in interface `SimpleValue`
      Overrides:
        `getByteValue` in class `XmlObjectBase`

    - #### getShortValue

          public short getShortValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a short.
      Specified by:
        `getShortValue` in interface `SimpleValue`
      Overrides:
        `getShortValue` in class `XmlObjectBase`

    - #### getIntValue

          public int getIntValue()

      Description copied from interface: `SimpleValue`
      Returns the value as an int.
      Specified by:
        `getIntValue` in interface `SimpleValue`
      Overrides:
        `getIntValue` in class `XmlObjectBase`

    - #### getLongValue

          public long getLongValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a long.
      Specified by:
        `getLongValue` in interface `SimpleValue`
      Overrides:
        `getLongValue` in class `XmlObjectBase`

    - #### getByteArrayValue

          public byte[] getByteArrayValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a byte array.
      Specified by:
        `getByteArrayValue` in interface `SimpleValue`
      Overrides:
        `getByteArrayValue` in class `XmlObjectBase`

    - #### getBooleanValue

          public boolean getBooleanValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a boolean.
      Specified by:
        `getBooleanValue` in interface `SimpleValue`
      Overrides:
        `getBooleanValue` in class `XmlObjectBase`

    - #### getCalendarValue

          public Calendar getCalendarValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a `Calendar`.
      Specified by:
        `getCalendarValue` in interface `SimpleValue`
      Overrides:
        `getCalendarValue` in class `XmlObjectBase`

    - #### getDateValue

          public Date getDateValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a `Date`.
      Specified by:
        `getDateValue` in interface `SimpleValue`
      Overrides:
        `getDateValue` in class `XmlObjectBase`

    - #### getGDateValue

          public GDate getGDateValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a `GDate`.
      Specified by:
        `getGDateValue` in interface `SimpleValue`
      Overrides:
        `getGDateValue` in class `XmlObjectBase`

    - #### getGDurationValue

          public GDuration getGDurationValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a `GDuration`.
      Specified by:
        `getGDurationValue` in interface `SimpleValue`
      Overrides:
        `getGDurationValue` in class `XmlObjectBase`

    - #### getQNameValue

          public QName getQNameValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a `QName`.
      Specified by:
        `getQNameValue` in interface `SimpleValue`
      Overrides:
        `getQNameValue` in class `XmlObjectBase`

    - #### getListValue

          public List<?> getListValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a `List` of friendly Java objects (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration).
      Specified by:
        `getListValue` in interface `SimpleValue`
      Overrides:
        `getListValue` in class `XmlObjectBase`

    - #### xgetListValue

          public List<? extends XmlAnySimpleType> xgetListValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a `List` of XmlAnySimpleType objects.
      Specified by:
        `xgetListValue` in interface `SimpleValue`
      Overrides:
        `xgetListValue` in class `XmlObjectBase`

    - #### getEnumValue

          public StringEnumAbstractBase getEnumValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a `StringEnumAbstractBase`.
      Specified by:
        `getEnumValue` in interface `SimpleValue`
      Overrides:
        `getEnumValue` in class `XmlObjectBase`

    - #### getStringValue

          public String getStringValue()

      Description copied from interface: `SimpleValue`
      Returns the value as a `String`.
      Specified by:
        `getStringValue` in interface `SimpleValue`
      Specified by:
        `getStringValue` in interface `XmlAnySimpleType`
      Overrides:
        `getStringValue` in class `XmlObjectBase`

    - #### set_boolean

          protected void set_boolean​(boolean v)

      Overrides:
        `set_boolean` in class `XmlObjectBase`

    - #### set_byte

          protected void set_byte​(byte v)

      Overrides:
        `set_byte` in class `XmlObjectBase`

    - #### set_short

          protected void set_short​(short v)

      Overrides:
        `set_short` in class `XmlObjectBase`

    - #### set_int

          protected void set_int​(int v)

      Overrides:
        `set_int` in class `XmlObjectBase`

    - #### set_long

          protected void set_long​(long v)

      Overrides:
        `set_long` in class `XmlObjectBase`

    - #### set_float

          protected void set_float​(float v)

      Overrides:
        `set_float` in class `XmlObjectBase`

    - #### set_double

          protected void set_double​(double v)

      Overrides:
        `set_double` in class `XmlObjectBase`

    - #### set_ByteArray

          protected void set_ByteArray​(byte[] b)

      Overrides:
        `set_ByteArray` in class `XmlObjectBase`

    - #### set_hex

          protected void set_hex​(byte[] b)

      Overrides:
        `set_hex` in class `XmlObjectBase`

    - #### set_b64

          protected void set_b64​(byte[] b)

      Overrides:
        `set_b64` in class `XmlObjectBase`

    - #### set_BigInteger

          protected void set_BigInteger​(BigInteger v)

      Overrides:
        `set_BigInteger` in class `XmlObjectBase`

    - #### set_BigDecimal

          protected void set_BigDecimal​(BigDecimal v)

      Overrides:
        `set_BigDecimal` in class `XmlObjectBase`

    - #### set_QName

          protected void set_QName​(QName v)

      Overrides:
        `set_QName` in class `XmlObjectBase`

    - #### set_Calendar

          protected void set_Calendar​(Calendar c)

      Overrides:
        `set_Calendar` in class `XmlObjectBase`

    - #### set_Date

          protected void set_Date​(Date d)

      Overrides:
        `set_Date` in class `XmlObjectBase`

    - #### set_GDate

          protected void set_GDate​(GDateSpecification d)

      Overrides:
        `set_GDate` in class `XmlObjectBase`

    - #### set_GDuration

          protected void set_GDuration​(GDurationSpecification d)

      Overrides:
        `set_GDuration` in class `XmlObjectBase`

    - #### set_enum

          protected void set_enum​(StringEnumAbstractBase e)

      Overrides:
        `set_enum` in class `XmlObjectBase`

    - #### set_list

          protected void set_list​(List<?> v)

      Overrides:
        `set_list` in class `XmlObjectBase`

    - #### set_xmlfloat

          protected void set_xmlfloat​(XmlObject v)

    - #### set_xmldouble

          protected void set_xmldouble​(XmlObject v)

    - #### set_xmldecimal

          protected void set_xmldecimal​(XmlObject v)

    - #### set_xmlduration

          protected void set_xmlduration​(XmlObject v)

    - #### set_xmldatetime

          protected void set_xmldatetime​(XmlObject v)

    - #### set_xmltime

          protected void set_xmltime​(XmlObject v)

    - #### set_xmldate

          protected void set_xmldate​(XmlObject v)

    - #### set_xmlgyearmonth

          protected void set_xmlgyearmonth​(XmlObject v)

    - #### set_xmlgyear

          protected void set_xmlgyear​(XmlObject v)

    - #### set_xmlgmonthday

          protected void set_xmlgmonthday​(XmlObject v)

    - #### set_xmlgday

          protected void set_xmlgday​(XmlObject v)

    - #### set_xmlgmonth

          protected void set_xmlgmonth​(XmlObject v)

    - #### equal_to

          protected boolean equal_to​(XmlObject xmlobj)

      Specified by:
        `equal_to` in class `XmlObjectBase`

    - #### value_hash_code

          protected int value_hash_code()

      Specified by:
        `value_hash_code` in class `XmlObjectBase`

    - #### validate_simpleval

          protected void validate_simpleval​(String lexical,
                                            ValidationContext ctx)

      Overrides:
        `validate_simpleval` in class `XmlObjectBase`