org.qi4j.api.type
Class ValueType

java.lang.Object
  extended by org.qi4j.api.type.ValueType
All Implemented Interfaces:
HasTypes
Direct Known Subclasses:
CollectionType, EnumType, MapType, ValueCompositeType

public class ValueType
extends java.lang.Object
implements HasTypes

Base class for types of values in ValueComposites and Properties.


Field Summary
protected  java.lang.Iterable<java.lang.Class<?>> types
           
 
Constructor Summary
ValueType(java.lang.Class<?> type)
           
ValueType(java.lang.Iterable<? extends java.lang.Class<?>> types)
           
 
Method Summary
static boolean isPrimitiveValue(java.lang.Object object)
          Check if a non-null object is of any of the Primitive Value Types or an array of them.
static boolean isPrimitiveValueType(java.lang.Class<?> type)
           
static boolean isPrimitiveValueType(ValueType valueType)
           
 java.lang.Class<?> mainType()
           
static ValueType of(java.lang.Class<?> type)
           
 java.lang.String toString()
           
 java.lang.Iterable<java.lang.Class<?>> types()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

types

protected final java.lang.Iterable<java.lang.Class<?>> types
Constructor Detail

ValueType

public ValueType(java.lang.Class<?> type)

ValueType

public ValueType(java.lang.Iterable<? extends java.lang.Class<?>> types)
Method Detail

of

public static ValueType of(java.lang.Class<?> type)

isPrimitiveValue

public static boolean isPrimitiveValue(java.lang.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:
java.lang.IllegalArgumentException - if object is null

isPrimitiveValueType

public static boolean isPrimitiveValueType(ValueType valueType)

isPrimitiveValueType

public static boolean isPrimitiveValueType(java.lang.Class<?> type)
See Also:
isPrimitiveValue(java.lang.Object)

mainType

public java.lang.Class<?> mainType()

types

public java.lang.Iterable<java.lang.Class<?>> types()
Specified by:
types in interface HasTypes

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object