org.qi4j.api.type

## Class ValueType

- java.lang.Object
- - org.qi4j.api.type.ValueType

- All Implemented Interfaces:
    HasTypes
  Direct Known Subclasses:
    CollectionType, EnumType, MapType, ValueCompositeType

      public class ValueType
      extends Object
      implements HasTypes

  Base class for types of values in ValueComposites and Properties.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Iterable<Class<?>>` | `types`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ValueType(Class<?> type)`
    `ValueType(Iterable<? extends Class<?>> types)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `isPrimitiveValue(Object object)` Check if a non-null object is of any of the Primitive Value Types or an array of them.
    `static boolean` | `isPrimitiveValueType(Class<?> type)`
    `static boolean` | `isPrimitiveValueType(ValueType valueType)`
    `Class<?>` | `mainType()`
    `static ValueType` | `of(Class<?> type)`
    `String` | `toString()`
    `Iterable<Class<?>>` | `types()`

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

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

- - ### Field Detail

    - #### types

          protected final Iterable<Class<?>> types

  - ### Constructor Detail

    - #### ValueType

          public ValueType(Class<?> type)

    - #### ValueType

          public ValueType(Iterable<? extends Class<?>> types)

  - ### Method Detail

    - #### of

          public static ValueType of(Class<?> type)

    - #### isPrimitiveValue

          public static boolean isPrimitiveValue(Object object)

      Check if a non-null object is of any of the Primitive Value Types or an array of them.

      String, Boolean, Integer, Double, Float, Long, Byte, Short and Character and their Java primitive types counterparts are considered as Primitive Value Types.

      Date, BigInteger, BigDecimal and JodaTime types are not considered as Primitive Value Types.

      Returns:
        true if object is a primitive value or an array of primitive values
      Throws:
        `IllegalArgumentException` - if object is null

    - #### isPrimitiveValueType

          public static boolean isPrimitiveValueType(ValueType valueType)

    - #### isPrimitiveValueType

          public static boolean isPrimitiveValueType(Class<?> type)

      See Also:
        `isPrimitiveValue(java.lang.Object)`

    - #### mainType

          public Class<?> mainType()

    - #### types

          public Iterable<Class<?>> types()

      Specified by:
        `types` in interface `HasTypes`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`