- java.lang.Object
-
- java.lang.Enum<AttributeType>
-
- org.arakhne.afc.attrs.attr.AttributeType
-
- All Implemented Interfaces:
Serializable
,Comparable<AttributeType>
public enum AttributeType extends Enum<AttributeType>
List of supported types for the metadata.- Version:
- 17.0 2020-01-04 14:41:51
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.advanced
- Maven Artifact Id:
- attributes
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BOOLEAN
Represents a boolean value.DATE
Represents a date.ENUMERATION
Represents an enumeration.INET_ADDRESS
Represents an Internet address.INTEGER
Represents an integer.OBJECT
Represents a java-object value.POINT
Represents a 2d point value.POINT3D
Represents a 3d point value.POLYLINE
Represents a list of 2d points.POLYLINE3D
Represents a list of 3d points.REAL
Represents a floating number.STRING
Represents a string.TIMESTAMP
Represents a timestamp value.TYPE
Represents a Java type.URI
Represents an URI.URL
Represents an URL.UUID
Represents an unique universal identifier.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Object
cast(Object obj)
Cast the specified value to corresponds to the default storage standard for attributes.static AttributeType
fromClass(Class<?> type)
Replies the Attribute type that corresponds to the specified type.static AttributeType
fromInteger(int type)
Replies the Attribute type that corresponds to the specified internal code.static AttributeType
fromValue(Object value)
Replies the Attribute type that corresponds to the specified value.abstract Object
getDefaultValue()
Replies the default value for the specified type.String
getLocalizedName()
Replies the name of this type (localized).boolean
instanceOf(Object value)
Replies if the specified value is an instanceof the type..abstract boolean
isAssignableFrom(AttributeType type)
Replies if a value of the given attribute type may be cast to a value of this attribute type.abstract boolean
isBaseType()
Replies if this attribute type is a base type, ie. a number, a boolean or a string.abstract boolean
isNullAllowed()
Replies if a null value is allowed for this attribute type.abstract boolean
isNumberType()
Replies if this attribute type is a number type.String
toString()
static AttributeType
valueOf(String name)
Returns the enum constant of this type with the specified name.static AttributeType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ENUMERATION
public static final AttributeType ENUMERATION
Represents an enumeration.- See Also:
Enum
-
TYPE
public static final AttributeType TYPE
Represents a Java type.
-
UUID
public static final AttributeType UUID
Represents an unique universal identifier.
-
INTEGER
public static final AttributeType INTEGER
Represents an integer.
-
REAL
public static final AttributeType REAL
Represents a floating number.
-
DATE
public static final AttributeType DATE
Represents a date.
-
BOOLEAN
public static final AttributeType BOOLEAN
Represents a boolean value.
-
INET_ADDRESS
public static final AttributeType INET_ADDRESS
Represents an Internet address.- See Also:
Inet4Address
,Inet6Address
,InetSocketAddress
-
URL
public static final AttributeType URL
Represents an URL.- See Also:
URL
-
URI
public static final AttributeType URI
Represents an URI.- See Also:
URI
-
TIMESTAMP
public static final AttributeType TIMESTAMP
Represents a timestamp value.
-
POINT3D
public static final AttributeType POINT3D
Represents a 3d point value.
-
POINT
public static final AttributeType POINT
Represents a 2d point value.
-
POLYLINE3D
public static final AttributeType POLYLINE3D
Represents a list of 3d points.
-
POLYLINE
public static final AttributeType POLYLINE
Represents a list of 2d points.
-
STRING
public static final AttributeType STRING
Represents a string.
-
OBJECT
public static final AttributeType OBJECT
Represents a java-object value.
-
-
Method Detail
-
values
public static AttributeType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (AttributeType c : AttributeType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static AttributeType 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 nameNullPointerException
- if the argument is null
-
getLocalizedName
@Pure public String getLocalizedName()
Replies the name of this type (localized).- Returns:
- the localized name of this type.
-
toString
@Pure public String toString()
- Overrides:
toString
in classEnum<AttributeType>
-
fromInteger
@Pure public static AttributeType fromInteger(int type)
Replies the Attribute type that corresponds to the specified internal code.- Parameters:
type
- is an integer representing an attribute type.- Returns:
- the type that corresponds to the given integer.
-
fromValue
@Pure public static AttributeType fromValue(Object value)
Replies the Attribute type that corresponds to the specified value.- Parameters:
value
- is the value to test.- Returns:
- the type that corresponds to the given value.
-
fromClass
@Pure public static AttributeType fromClass(Class<?> type)
Replies the Attribute type that corresponds to the specified type.- Parameters:
type
- is the type to test.- Returns:
- the type that corresponds to the given value.
-
instanceOf
@Pure public boolean instanceOf(Object value)
Replies if the specified value is an instanceof the type..- Parameters:
value
- is the value to test.- Returns:
true
if the given value is an instance of this attribute type, otherwisefalse
.
-
getDefaultValue
@Pure public abstract Object getDefaultValue()
Replies the default value for the specified type.- Returns:
- the default value.
-
isBaseType
@Pure public abstract boolean isBaseType()
Replies if this attribute type is a base type, ie. a number, a boolean or a string.- Returns:
true
if this type is a base type, otherwisefalse
-
isNumberType
@Pure public abstract boolean isNumberType()
Replies if this attribute type is a number type. A number type is always a base type.- Returns:
true
if this type is a number type, otherwisefalse
- Since:
- 4.0
-
isNullAllowed
@Pure public abstract boolean isNullAllowed()
Replies if a null value is allowed for this attribute type.- Returns:
true
if this type allowsnull
value, otherwisefalse
-
isAssignableFrom
@Pure public abstract boolean isAssignableFrom(AttributeType type)
Replies if a value of the given attribute type may be cast to a value of this attribute type.Caution: even if isAssignableFrom is replying
true
, theAttributeValue.cast(AttributeType)
andAttributeValue.castAndSet(AttributeType, Object)
may fail if the target type does not support a specifical value of the source type. The isAssignableFrom function repliestrue
if a least one value of the source type is assignable to a value of the target type.- Parameters:
type
- the type.- Returns:
true
if a value of the giventype
may be cast to a value ofthis
; otherwisefalse
.- Since:
- 4.0
-
cast
@Pure public abstract Object cast(Object obj)
Cast the specified value to corresponds to the default storage standard for attributes.- Parameters:
obj
- is the object to cast- Returns:
- the casted value
- Throws:
ClassCastException
- if is impossible to cast.NullPointerException
- if null value is not allowed.
-
-