Package net.sf.ehcache.search.attribute
Enum AttributeType
- java.lang.Object
-
- java.lang.Enum<AttributeType>
-
- net.sf.ehcache.search.attribute.AttributeType
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<AttributeType>
public enum AttributeType extends java.lang.Enum<AttributeType>
Defines the legal set of runtime types for search attributes- Author:
- teck
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static java.util.Set<java.lang.Class<?>>getSupportedJavaTypes()booleanisComparable()Is this type comparable?static booleanisSupportedType(java.lang.Object value)Test the given value to see if it is a legal typestatic AttributeTypetypeFor(java.lang.Class<?> c)Get the appropriate @{linkAttributeTypeenum for the given JavaClassstatic AttributeTypetypeFor(java.lang.String name, java.lang.Object value)Get the appropriate @{linkAttributeTypeenum for the given object value.abstract voidvalidateValue(java.lang.String name, java.lang.Object value)Validate that the given value is in fact of the correct typestatic AttributeTypevalueOf(java.lang.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
-
BOOLEAN
public static final AttributeType BOOLEAN
Boolean type
-
BYTE
public static final AttributeType BYTE
Byte type
-
CHAR
public static final AttributeType CHAR
Character type
-
DOUBLE
public static final AttributeType DOUBLE
Double type
-
FLOAT
public static final AttributeType FLOAT
Float type
-
INT
public static final AttributeType INT
Integer type
-
LONG
public static final AttributeType LONG
Long type
-
SHORT
public static final AttributeType SHORT
Short type
-
DATE
public static final AttributeType DATE
Date type
-
SQL_DATE
public static final AttributeType SQL_DATE
SQL Date type
-
ENUM
public static final AttributeType ENUM
Enum type
-
STRING
public static final AttributeType STRING
String type
-
-
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(java.lang.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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
typeFor
public static AttributeType typeFor(java.lang.String name, java.lang.Object value) throws SearchException
Get the appropriate @{linkAttributeTypeenum for the given object value.- Parameters:
name- the attribute name (only meaningful to message if exception thrown)value- the value to lookup the type for- Returns:
- the attribute type for this value
- Throws:
SearchException- if the given value is not valid for a search attribute
-
typeFor
public static AttributeType typeFor(java.lang.Class<?> c)
Get the appropriate @{linkAttributeTypeenum for the given JavaClass- Parameters:
c-- Returns:
- the attribute type for this value
-
isSupportedType
public static boolean isSupportedType(java.lang.Object value)
Test the given value to see if it is a legal type- Parameters:
value-- Returns:
- true if the given value is valid as a search attribute
-
validateValue
public abstract void validateValue(java.lang.String name, java.lang.Object value) throws SearchExceptionValidate that the given value is in fact of the correct type- Parameters:
name- the attribute name (only meaningful to message if exception thrown)value- the value to validate against this type- Throws:
SearchException- if the given value is not a valid instance of this type
-
isComparable
public boolean isComparable()
Is this type comparable?- Returns:
- true if this type is comparable
-
getSupportedJavaTypes
public static java.util.Set<java.lang.Class<?>> getSupportedJavaTypes()
- Returns:
- all supported built-in types
-
-