Package org.faktorips.datatype
Class ArrayOfValueDatatype
java.lang.Object
org.faktorips.datatype.AbstractDatatype
org.faktorips.datatype.ArrayOfValueDatatype
- All Implemented Interfaces:
Comparable<Datatype>,Datatype,ValueDatatype
Datatype representing an array of primitive Datatypes with a dimension.
- Author:
- Jan Ortmann
-
Field Summary
Fields 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
ConstructorsConstructorDescriptionArrayOfValueDatatype(Datatype datatype, int dimension) Constructs a new array datatype based on the given underlying datatype and the dimension. -
Method Summary
Modifier and TypeMethodDescriptionbooleanareValuesEqual(String valueA, String valueB) Returnstrueif both given strings represent the same value defined by this datatype.intCompares the values created from the two given strings.Returns the array datatype's basic datatype.static final StringgetBasicDatatypeName(String datatypeName) Returns the basic datatype name specified in the given datatypeName.Returns the datatype's default value.intReturns the array's dimension.static final intgetDimension(String datatypeName) Returns the number of dimensions specified in the given datatypeName.getName()Returns the datatype's name.Returns the datatype's qualified name.If the value is null, null will be returned.If this datatype represents a primitive type, this method returns the datatype that represents the wrapper class.booleanReturnstrueif this datatype is an abstract datatype in means of the object oriented paradigm.static final booleanisArrayDatatype(String datatypeName) Returns if the provided string represents an ArrayDatatype.booleanReturnstrueif this is an immutable datatype,falseotherwise.booleanReturnstrueif this is a mutable datatype,falseif it is an immutable datatype.booleanReturnstrueif the given string isnullor the representation of the null object (if the datatype value class makes use of the null object pattern.)booleanisParsable(String value) Null is parsable.booleanReturnstrueif this datatype represents one of Java's primitive types.booleanReturnstrueif this datatype represents values.booleanvalueToString(Object value) If the value is null, null will be returned.Methods inherited from class org.faktorips.datatype.AbstractDatatype
checkReadyToUse, compareTo, equals, hashCode, hasNullObject, isEnum, isVoid, matchDatatype, toStringMethods 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
hasNullObject, isEnum, isVoidMethods inherited from interface org.faktorips.datatype.ValueDatatype
checkReadyToUse, getNullObjectId
-
Constructor Details
-
ArrayOfValueDatatype
Constructs a new array datatype based on the given underlying datatype and the dimension.
-
-
Method Details
-
getDimension
Returns the number of dimensions specified in the given datatypeName.Examples:
"Money" specifies 0 dimensions. "Money[]" specifies 1 dimension. "Money[][]" specifies 2 dimensions. -
getBasicDatatypeName
Returns the basic datatype name specified in the given datatypeName.Examples:
"Money" specifies basic datatype Money. "Money[]" specifies basic datatype Money. "Money[][]" specifies basic datatype Money. -
isArrayDatatype
Returns if the provided string represents an ArrayDatatype. -
getBasicDatatype
Returns the array datatype's basic datatype. E.g. for an array of Money values,Datatype.MONEYis the basic datatype. -
getDimension
public int getDimension()Returns the array's dimension. -
isImmutable
public boolean isImmutable()Description copied from interface:ValueDatatypeReturnstrueif this is an immutable datatype,falseotherwise.- Specified by:
isImmutablein interfaceValueDatatype- Returns:
- whether this is an immutable datatype
-
isMutable
public boolean isMutable()Description copied from interface:ValueDatatypeReturnstrueif this is a mutable datatype,falseif it is an immutable datatype.- Specified by:
isMutablein interfaceValueDatatype- Returns:
- whether this is a mutable datatype
-
getName
Description copied from interface:DatatypeReturns the datatype's name. -
getQualifiedName
Description copied from interface:DatatypeReturns the datatype's qualified name.The qualified name identifies the datatype.
- Specified by:
getQualifiedNamein interfaceDatatype
-
isPrimitive
public boolean isPrimitive()Description copied from interface:DatatypeReturnstrueif this datatype represents one of Java's primitive types.- Specified by:
isPrimitivein interfaceDatatype
-
isAbstract
public boolean isAbstract()Description copied from interface:DatatypeReturnstrueif this datatype is an abstract datatype in means of the object oriented paradigm.- Specified by:
isAbstractin interfaceDatatype
-
getDefaultValue
Description copied from interface:ValueDatatypeReturns the datatype's default value. For datatypes representing objects the method returnsnull. For datatypes representing Java primitives the Java default value is returned, e.g. 0 for int.- Specified by:
getDefaultValuein interfaceValueDatatype- See Also:
-
isValueDatatype
public boolean isValueDatatype()Description copied from interface:DatatypeReturnstrueif this datatype represents values.If the method returns
true, the datatype can be safely casted toValueDatatype.- Specified by:
isValueDatatypein interfaceDatatype
-
getWrapperType
Description copied from interface:ValueDatatypeIf this datatype represents a primitive type, this method returns the datatype that represents the wrapper class. Returnsnullif this datatype does not represent a primitive.- Specified by:
getWrapperTypein interfaceValueDatatype
-
isParsable
Null is parsable. Other values are not supported yet. Returnstrueif the given string can be parsed to a value of this datatype. Returnsfalseotherwise.- Specified by:
isParsablein interfaceValueDatatype
-
getValue
If the value is null, null will be returned. Other values are not supported yet.- Specified by:
getValuein interfaceValueDatatype- Parameters:
value- the string representation of a value- Returns:
- the value as instance of the class this datatype represents
- See Also:
-
valueToString
If the value is null, null will be returned. Other values are not supported yet.- Specified by:
valueToStringin interfaceValueDatatype- Parameters:
value- a value of this datatype- Returns:
- the value's string representation
- See Also:
-
isNull
Description copied from interface:ValueDatatypeReturnstrueif the given string isnullor the representation of the null object (if the datatype value class makes use of the null object pattern.) Returnsfalseotherwise.- Specified by:
isNullin interfaceValueDatatype- See Also:
-
NullObject
-
supportsCompare
public boolean supportsCompare()- Specified by:
supportsComparein interfaceValueDatatype- Returns:
trueif this datatype is able to compare two values.
-
compare
Description copied from interface:ValueDatatypeCompares the values created from the two given strings.- Specified by:
comparein interfaceValueDatatype- Parameters:
valueA- The value to compare to valueBvalueB- The value to compare to valueA- Returns:
- A value less than 0 if valueA is less than valueB, 0 if valueA is equal to valueB and a value greater than 0 if valueA is greater than valueB.
- See Also:
-
areValuesEqual
Description copied from interface:ValueDatatypeReturnstrueif both given strings represent the same value defined by this datatype. The String " 1" (a blank followed by the char '1') and "1" (just the char '1') are equal if the datatype is anInteger, but will not be equal if the datatype is aString.- Specified by:
areValuesEqualin interfaceValueDatatype- Parameters:
valueA- The first parameter to comparevalueB- The second parameter to compare- Returns:
trueif the two values are equal according to the datatype, returnsfalseif they are different.
-