Package org.faktorips.datatype
Class GenericEnumDatatype
java.lang.Object
org.faktorips.datatype.GenericValueDatatype
org.faktorips.datatype.GenericEnumDatatype
- All Implemented Interfaces:
Comparable<Datatype>,Datatype,EnumDatatype,NamedDatatype,ValueDatatype
- Direct Known Subclasses:
DefaultGenericEnumDatatype
Generic enum datatype. See the superclass for more Details.
- Author:
- Jan Ortmann
-
Field Summary
FieldsFields inherited from class org.faktorips.datatype.GenericValueDatatype
MSGCODE_GET_ALL_VALUES_METHOD_NOT_FOUND, MSGCODE_GETVALUE_METHOD_NOT_FOUND, MSGCODE_ISPARSABLE_METHOD_NOT_FOUND, MSGCODE_JAVACLASS_NOT_FOUND, MSGCODE_PREFIX, MSGCODE_PREFIX_GET_ALL_VALUES_METHOD, MSGCODE_PREFIX_GET_VALUE_METHOD, MSGCODE_PREFIX_IS_PARSABLE_METHOD, MSGCODE_PREFIX_TO_STRING_METHOD, MSGCODE_PREFIX_VALUE_OF_METHOD, MSGCODE_SPECIALCASE_NULL_IS_NOT_NULL, MSGCODE_SPECIALCASE_NULL_NOT_FOUND, MSGCODE_TOSTRING_METHOD_NOT_FOUND, MSGCODE_VALUE_OF_METHOD_NOT_FOUNDFields inherited from interface org.faktorips.datatype.Datatype
BIG_DECIMAL, BOOLEAN, DECIMAL, DOUBLE, GREGORIAN_CALENDAR, INTEGER, LONG, MONEY, PRIMITIVE_BOOLEAN, PRIMITIVE_INT, PRIMITIVE_LONG, STRING, VOID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.faktorips.runtime.MessageListValidates the value datatype and returns a message list containing error messages if the datatype is invalid.protected voidString[]getAllValueIds(boolean includeNull) Returns the IDs of all values defined in the enum type.Returns the name of the getName(String) method.protected StringgetNameFromValue(Object value) getValueName(String id) Returns a short description of the value of this datatype specified by the ID.voidInitializes the cache with the data from the underlying class.booleanReturnstrueif the values' id and names are cached,falseotherwise.booleanisParsable(String value) Returnstrueif the given string can be parsed to a value of this datatype.booleanReturnstrueif an implementation of this interface supports names that describe the datatype's value.voidsetCacheData(boolean cacheData) Sets totrueif the values' ids and names should be cached, otherwisefalse.voidsetGetNameMethodName(String getNameMethodName) Sets the name of the getName(String) method.voidsetIsSupportingNames(boolean isSupportingNames) Methods inherited from class org.faktorips.datatype.GenericValueDatatype
areValuesEqual, compare, compareTo, equals, getAdaptedClass, getAdaptedClassName, getAllValuesMethod, getAllValuesMethodName, getDefaultValue, getIsParsableMethodName, getJavaClassName, getName, getNullObjectId, getQualifiedName, getToStringMethod, getToStringMethodName, getValue, getValueOfMethodName, getWrapperType, hashCode, hasNullObject, isAbstract, isEnum, isImmutable, isMutable, isNull, isPrimitive, isValueDatatype, isVoid, setAllValuesMethodName, setIsParsableMethodName, setNullObjectDefined, setNullObjectId, setQualifiedName, setToStringMethodName, setValueOfMethodName, supportsCompare, toString, valueToStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface org.faktorips.datatype.Datatype
getName, getQualifiedName, hasNullObject, isAbstract, isEnum, isPrimitive, isValueDatatype, isVoidMethods inherited from interface org.faktorips.datatype.EnumDatatype
getValueByNameMethods inherited from interface org.faktorips.datatype.NamedDatatype
getValueByName, getValueNameMethods inherited from interface org.faktorips.datatype.ValueDatatype
areValuesEqual, compare, getDefaultValue, getNullObjectId, getValue, getWrapperType, isImmutable, isMutable, isNull, supportsCompare, valueToString
-
Field Details
-
MSGCODE_PREFIX_GET_NAME_METHOD
- See Also:
-
-
Constructor Details
-
GenericEnumDatatype
public GenericEnumDatatype()
-
-
Method Details
-
isCacheData
public boolean isCacheData()Returnstrueif the values' id and names are cached,falseotherwise. -
setCacheData
public void setCacheData(boolean cacheData) Sets totrueif the values' ids and names should be cached, otherwisefalse. Settingfalsealso clears the cache. -
checkReadyToUse
public org.faktorips.runtime.MessageList checkReadyToUse()Description copied from interface:ValueDatatypeValidates the value datatype and returns a message list containing error messages if the datatype is invalid. If the datatype is valid an empty list is returned.Value datatypes like the predefined datatypes (defined by the constants in this class) are always valid. However generic datatypes that implement this interface might be invalid.
- Specified by:
checkReadyToUsein interfaceValueDatatype- Overrides:
checkReadyToUsein classGenericValueDatatype
-
getGetNameMethodName
Returns the name of the getName(String) method. -
setGetNameMethodName
Sets the name of the getName(String) method. -
isSupportingNames
public boolean isSupportingNames()Description copied from interface:NamedDatatypeReturnstrueif an implementation of this interface supports names that describe the datatype's value. E.g. an enum datatype PaymentMode might return the name "annual" for the annual payment mode with ID "1". If this method returnsfalsea call to theNamedDatatype.getValueName(String)method is supposed to throw anIllegalStateException.- Specified by:
isSupportingNamesin interfaceNamedDatatype
-
setIsSupportingNames
public void setIsSupportingNames(boolean isSupportingNames) -
getAllValueIds
Description copied from interface:EnumDatatypeReturns the IDs of all values defined in the enum type.- Specified by:
getAllValueIdsin interfaceEnumDatatype- Parameters:
includeNull-trueto get the ID for the NULL-Value included,falsefor not include the NULL-Value. Note that the NULL-Value can be the Javanullor a special case NULL-value ID.
-
getValueName
Description copied from interface:NamedDatatypeReturns a short description of the value of this datatype specified by the ID.- Specified by:
getValueNamein interfaceNamedDatatype
-
getNameFromValue
-
isParsable
Description copied from interface:ValueDatatypeReturnstrueif the given string can be parsed to a value of this datatype. Returnsfalseotherwise.- Specified by:
isParsablein interfaceValueDatatype- Overrides:
isParsablein classGenericValueDatatype
-
initCache
public void initCache()Initializes the cache with the data from the underlying class. -
clearCache
protected void clearCache()- Overrides:
clearCachein classGenericValueDatatype
-