java.lang.Object
java.lang.Enum<OType>
com.orientechnologies.orient.core.metadata.schema.OType
All Implemented Interfaces:
Serializable, Comparable<OType>, java.lang.constant.Constable

public enum OType extends Enum<OType>
Generic representation of a type.
allowAssignmentFrom accepts any class, but Array.class means that the type accepts generic Arrays.
Author:
Luca Garulli (l.garulli--(at)--orientdb.com)
  • Enum Constant Details

    • BOOLEAN

      public static final OType BOOLEAN
    • INTEGER

      public static final OType INTEGER
    • SHORT

      public static final OType SHORT
    • LONG

      public static final OType LONG
    • FLOAT

      public static final OType FLOAT
    • DOUBLE

      public static final OType DOUBLE
    • DATETIME

      public static final OType DATETIME
    • STRING

      public static final OType STRING
    • BINARY

      public static final OType BINARY
    • EMBEDDED

      public static final OType EMBEDDED
    • EMBEDDEDLIST

      public static final OType EMBEDDEDLIST
    • EMBEDDEDSET

      public static final OType EMBEDDEDSET
    • EMBEDDEDMAP

      public static final OType EMBEDDEDMAP
    • LINKSET

      public static final OType LINKSET
    • LINKMAP

      public static final OType LINKMAP
    • BYTE

      public static final OType BYTE
    • TRANSIENT

      public static final OType TRANSIENT
    • DATE

      public static final OType DATE
    • CUSTOM

      public static final OType CUSTOM
    • DECIMAL

      public static final OType DECIMAL
    • LINKBAG

      public static final OType LINKBAG
    • ANY

      public static final OType ANY
  • Field Details

    • TYPES

      protected static final OType[] TYPES
    • TYPES_BY_ID

      protected static final OType[] TYPES_BY_ID
    • TYPES_BY_CLASS

      protected static final Map<Class<?>,OType> TYPES_BY_CLASS
    • name

      protected final String name
    • id

      protected final int id
    • javaDefaultType

      protected final Class<?> javaDefaultType
    • allowAssignmentFrom

      protected final Class<?>[] allowAssignmentFrom
    • castable

      protected final Set<OType> castable
  • Method Details

    • values

      public static OType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static OType valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getById

      public static OType getById(byte iId)
      Return the type by ID.
      Parameters:
      iId - The id to search
      Returns:
      The type if any, otherwise null
    • getId

      public final int getId()
      Get the identifier of the type. use this instead of Enum.ordinal() for guarantee a cross code version identifier.
      Returns:
      the identifier of the type.
    • getTypeByClass

      public static OType getTypeByClass(Class<?> iClass)
      Return the correspondent type by checking the "assignability" of the class received as parameter.
      Parameters:
      iClass - Class to check
      Returns:
      OType instance if found, otherwise null
    • getTypeByValue

      public static OType getTypeByValue(Object value)
    • isSimpleType

      public static boolean isSimpleType(Object iObject)
    • convert

      public static Object convert(Object iValue, Class<?> iTargetClass)
      Convert types based on the iTargetClass parameter.
      Parameters:
      iValue - Value to convert
      iTargetClass - Expected class
      Returns:
      The converted value or the original if no conversion was applied
    • increment

      public static Number increment(Number a, Number b)
    • castComparableNumber

      public static Number[] castComparableNumber(Number context, Number max)
    • asInt

      public int asInt(Object iValue)
      Convert the input object to an integer.
      Parameters:
      iValue - Any type supported
      Returns:
      The integer value if the conversion succeed, otherwise the IllegalArgumentException exception
    • asLong

      public long asLong(Object iValue)
      Convert the input object to a long.
      Parameters:
      iValue - Any type supported
      Returns:
      The long value if the conversion succeed, otherwise the IllegalArgumentException exception
    • asFloat

      public float asFloat(Object iValue)
      Convert the input object to a float.
      Parameters:
      iValue - Any type supported
      Returns:
      The float value if the conversion succeed, otherwise the IllegalArgumentException exception
    • asDouble

      public double asDouble(Object iValue)
      Convert the input object to a double.
      Parameters:
      iValue - Any type supported
      Returns:
      The double value if the conversion succeed, otherwise the IllegalArgumentException exception
    • asString

      @Deprecated public String asString(Object iValue)
      Deprecated.
      Convert the input object to a string.
      Parameters:
      iValue - Any type supported
      Returns:
      The string if the conversion succeed, otherwise the IllegalArgumentException exception
    • isMultiValue

      public boolean isMultiValue()
    • isList

      public boolean isList()
    • isLink

      public boolean isLink()
    • isEmbedded

      public boolean isEmbedded()
    • getDefaultJavaType

      public Class<?> getDefaultJavaType()
    • getCastable

      public Set<OType> getCastable()
    • getJavaTypes

      @Deprecated public Class<?>[] getJavaTypes()
      Deprecated.
    • getName

      public String getName()