Package org.faktorips.datatype
Class PrimitiveIntegerDatatype
java.lang.Object
org.faktorips.datatype.AbstractDatatype
org.faktorips.datatype.AbstractPrimitiveDatatype
org.faktorips.datatype.PrimitiveIntegerDatatype
- All Implemented Interfaces:
Comparable<Datatype>,Datatype,NumericDatatype,ValueDatatype
Datatype for the primitive
int.-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandivisibleWithoutRemainder(String dividend, String divisor) Decides whether the given dividend can be divided by the divisor without remainder or not.Returns the datatype's default value.getName()Returns the datatype's name.Returns the datatype's qualified name.This method parses the given string and returns the value as an instance of the class this value datatype represents.If this datatype represents a primitive type, this method returns the datatype that represents the wrapper class.booleanSubtraction.booleanMethods inherited from class org.faktorips.datatype.AbstractPrimitiveDatatype
areValuesEqual, compare, getNullObjectId, hasNullObject, isAbstract, isImmutable, isMutable, isParsable, isPrimitive, isValueDatatype, valueToStringMethods inherited from class org.faktorips.datatype.AbstractDatatype
checkReadyToUse, compareTo, equals, hashCode, 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, isAbstract, isEnum, isPrimitive, isValueDatatype, isVoidMethods inherited from interface org.faktorips.datatype.ValueDatatype
areValuesEqual, checkReadyToUse, compare, getNullObjectId, isImmutable, isMutable, isNull, isParsable, valueToString
-
Constructor Details
-
PrimitiveIntegerDatatype
public PrimitiveIntegerDatatype()
-
-
Method Details
-
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
-
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
-
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:
-
getValue
Description copied from interface:ValueDatatypeThis method parses the given string and returns the value as an instance of the class this value datatype represents.Use with caution: During development time Faktor-IPS maintains all values with their string representation. This allows to change the value's datatype without the need to convert the value from one class to another (e.g. if the string representation is 42 you can change the datatype from integer to string without converting the integer object to a string object.
May throw different exceptions if the given string does not represent any value, for example a
NumberFormatExceptionwhen"twelve"is passed togetValue(String).- Specified by:
getValuein interfaceValueDatatype- Specified by:
getValuein classAbstractPrimitiveDatatype- Parameters:
value- the string representation of a value- Returns:
- the value as instance of the class this datatype represents
- See Also:
-
supportsCompare
public boolean supportsCompare()- Specified by:
supportsComparein interfaceValueDatatype- Returns:
trueif this datatype is able to compare two values.
-
subtract
Description copied from interface:NumericDatatypeSubtraction. This method is used to validate numeric ranges, see RangeValueSet as an example.- Specified by:
subtractin interfaceNumericDatatype- Parameters:
minuend- The value to be reduced.subtrahend- The value to be used to reduce the minuend- Returns:
- The result of "minuend - subtrahend".
-
divisibleWithoutRemainder
Description copied from interface:NumericDatatypeDecides whether the given dividend can be divided by the divisor without remainder or not. This method is used to validate numeric ranges, see RangeValueSet as an example.- Specified by:
divisibleWithoutRemainderin interfaceNumericDatatype- Parameters:
dividend- The value to be divideddivisor- The value to be used to divide the dividend- Returns:
trueif dividend can be divided by the divisor without remainder,falseotherwise.
-
hasDecimalPlaces
public boolean hasDecimalPlaces()- Specified by:
hasDecimalPlacesin interfaceNumericDatatype
-