org.apache.olingo.commons.api.data

## Class Valuable

- java.lang.Object
- - org.apache.olingo.commons.api.data.Annotatable
  - - org.apache.olingo.commons.api.data.Valuable

- Direct Known Subclasses:
    Annotation, Parameter, Property

      public abstract class Valuable
      extends Annotatable

  Defines a value with an according type.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Valuable()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<?>` | `asCollection()` Get the value as collection or null if it is not a collection ValueType
    `ComplexValue` | `asComplex()` Get the value in its complex representation or null if it is not based on a complex ValueType
    `Object` | `asEnum()` Get the value in its enum representation or null if it is not based on a enum ValueType
    `Geospatial` | `asGeospatial()` Get the value in its geospatial representation or null if it is not based on a geospatial ValueType
    `Object` | `asPrimitive()` Get the value in its primitive representation or null if it is not based on a primitive ValueType
    `boolean` | `equals(Object o)`
    `String` | `getType()` Get string representation of type (can be null if not set).
    `Object` | `getValue()` Get the value
    `ValueType` | `getValueType()` Get value type for this valuable.
    `int` | `hashCode()`
    `boolean` | `isCollection()` Check if Valuable contains a COLLECTION_* ValueType
    `boolean` | `isComplex()` Check if Valuable contains a COMPLEX or COLLECTION_COMPLEX ValueType
    `boolean` | `isEnum()` Check if Valuable contains a ENUM or COLLECTION_ENUM ValueType
    `boolean` | `isGeospatial()` Check if Valuable contains a GEOSPATIAL or COLLECTION_GEOSPATIAL ValueType
    `boolean` | `isNull()` Check if according value is `null`.
    `boolean` | `isPrimitive()` Check if Valuable contains a PRIMITIVE or COLLECTION_PRIMITIVE ValueType
    `void` | `setType(String type)` Set string representation of type.
    `void` | `setValue(ValueType valueType, Object value)` Set value and value type.
    `String` | `toString()`

    - ### Methods inherited from class org.apache.olingo.commons.api.data.Annotatable

      `getAnnotations`

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

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

- - ### Constructor Detail

    - #### Valuable

          public Valuable()

  - ### Method Detail

    - #### isNull

          public boolean isNull()

      Check if according value is `null`.
      Returns:
        `true` if value is `null`, otherwise `false`

    - #### getType

          public String getType()

      Get string representation of type (can be null if not set).
      Returns:
        string representation of type (can be null if not set)

    - #### setType

          public void setType(String type)

      Set string representation of type.
      Parameters:
        `type` - string representation of type

    - #### isPrimitive

          public boolean isPrimitive()

      Check if Valuable contains a PRIMITIVE or COLLECTION_PRIMITIVE ValueType
      Returns:
        true if ValueType is a PRIMITIVE or COLLECTION_PRIMITIVE, otherwise false

    - #### isGeospatial

          public boolean isGeospatial()

      Check if Valuable contains a GEOSPATIAL or COLLECTION_GEOSPATIAL ValueType
      Returns:
        true if ValueType is a GEOSPATIAL or COLLECTION_GEOSPATIAL, otherwise false

    - #### isEnum

          public boolean isEnum()

      Check if Valuable contains a ENUM or COLLECTION_ENUM ValueType
      Returns:
        true if ValueType is a ENUM or COLLECTION_ENUM, otherwise false

    - #### isComplex

          public boolean isComplex()

      Check if Valuable contains a COMPLEX or COLLECTION_COMPLEX ValueType
      Returns:
        true if ValueType is a COMPLEX or COLLECTION_COMPLEX, otherwise false

    - #### isCollection

          public boolean isCollection()

      Check if Valuable contains a COLLECTION_* ValueType
      Returns:
        true if ValueType is a COLLECTION_*, otherwise false

    - #### asPrimitive

          public Object asPrimitive()

      Get the value in its primitive representation or null if it is not based on a primitive ValueType
      Returns:
        primitive representation or null if it is not based on a primitive ValueType

    - #### asGeospatial

          public Geospatial asGeospatial()

      Get the value in its geospatial representation or null if it is not based on a geospatial ValueType
      Returns:
        geospatial representation or null if it is not based on a geospatial ValueType

    - #### asEnum

          public Object asEnum()

      Get the value in its enum representation or null if it is not based on a enum ValueType
      Returns:
        enum representation or null if it is not based on a enum ValueType

    - #### asComplex

          public ComplexValue asComplex()

      Get the value in its complex representation or null if it is not based on a complex ValueType
      Returns:
        primitive complex or null if it is not based on a complex ValueType

    - #### asCollection

          public List<?> asCollection()

      Get the value as collection or null if it is not a collection ValueType
      Returns:
        collection or null if it is not a collection ValueType

    - #### getValue

          public Object getValue()

      Get the value
      Returns:
        the value

    - #### setValue

          public void setValue(ValueType valueType,
                               Object value)

      Set value and value type.
      Parameters:
        `valueType` - value type
        `value` - value

    - #### getValueType

          public ValueType getValueType()

      Get value type for this valuable.
      Returns:
        value type for this valuable

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2013–2020 The Apache Software Foundation. All rights reserved.