Enum AttributeType

    • 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 name
        NullPointerException - if the argument is null
      • getLocalizedName

        @Pure
        public String getLocalizedName()
        Replies the name of this type (localized).
        Returns:
        the localized name of this type.
      • 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, otherwise false.
      • 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, otherwise false
      • 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, otherwise false
        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 allows null value, otherwise false
      • 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, the AttributeValue.cast(AttributeType) and AttributeValue.castAndSet(AttributeType, Object) may fail if the target type does not support a specifical value of the source type. The isAssignableFrom function replies true 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 given type may be cast to a value of this; otherwise false.
        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.