Enum OType
- All Implemented Interfaces:
Serializable,Comparable<OType>,java.lang.constant.Constable
Generic representation of a type.
allowAssignmentFrom accepts any class, but Array.class means that the type accepts generic Arrays.
allowAssignmentFrom accepts any class, but Array.class means that the type accepts generic Arrays.
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondoubleConvert the input object to a double.floatConvert the input object to a float.intConvert the input object to an integer.longConvert the input object to a long.Deprecated.static Number[]castComparableNumber(Number context, Number max) static ObjectConvert types based on the iTargetClass parameter.static OTypegetById(byte iId) Return the type by ID.Class<?>final intgetId()Get the identifier of the type.Class<?>[]Deprecated.getName()static OTypegetTypeByClass(Class<?> iClass) Return the correspondent type by checking the "assignability" of the class received as parameter.static OTypegetTypeByValue(Object value) static NumberbooleanbooleanisLink()booleanisList()booleanstatic booleanisSimpleType(Object iObject) static OTypeReturns the enum constant of this type with the specified name.static OType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
BOOLEAN
-
INTEGER
-
SHORT
-
LONG
-
FLOAT
-
DOUBLE
-
DATETIME
-
STRING
-
BINARY
-
EMBEDDED
-
EMBEDDEDLIST
-
EMBEDDEDSET
-
EMBEDDEDMAP
-
LINK
-
LINKLIST
-
LINKSET
-
LINKMAP
-
BYTE
-
TRANSIENT
-
DATE
-
CUSTOM
-
DECIMAL
-
LINKBAG
-
ANY
-
-
Field Details
-
TYPES
-
TYPES_BY_ID
-
TYPES_BY_CLASS
-
name
-
id
protected final int id -
javaDefaultType
-
allowAssignmentFrom
-
castable
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
getById
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 ofEnum.ordinal()for guarantee a cross code version identifier.- Returns:
- the identifier of the type.
-
getTypeByClass
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
-
isSimpleType
-
convert
Convert types based on the iTargetClass parameter.- Parameters:
iValue- Value to convertiTargetClass- Expected class- Returns:
- The converted value or the original if no conversion was applied
-
increment
-
castComparableNumber
-
asInt
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
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
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
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.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
-
getCastable
-
getJavaTypes
Deprecated. -
getName
-