Package org.faktorips.codegen.dthelpers
Class AbstractPrimitiveDatatypeHelper
java.lang.Object
org.faktorips.codegen.dthelpers.AbstractDatatypeHelper
org.faktorips.codegen.dthelpers.AbstractPrimitiveDatatypeHelper
- All Implemented Interfaces:
BaseDatatypeHelper<JavaCodeFragment>,DatatypeHelper,PrimitiveDatatypeHelper
- Direct Known Subclasses:
PrimitiveBooleanHelper,PrimitiveIntegerHelper,PrimitiveLongHelper
public abstract class AbstractPrimitiveDatatypeHelper
extends AbstractDatatypeHelper
implements PrimitiveDatatypeHelper
Abstract base class for all primitive datatypes.
- Author:
- Jan Ortmann
-
Field Summary
Fields inherited from interface org.faktorips.codegen.DatatypeHelper
BIG_DECIMAL, BOOLEAN, DECIMAL, INTEGER, LONG, MONEY, PRIMITIVE_BOOLEAN, PRIMITIVE_INTEGER, STRING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetToStringExpression(String fieldName) Returns aJavaCodeFragmentcontaining the code for converting the value (of the given field) to a string representation with respect to its data type.newEnumValueSetInstance(String[] values, boolean containsNull) newEnumValueSetInstance(JavaCodeFragment valueCollection, JavaCodeFragment containsNullExpression) newInstanceFromExpression(String expression) Returns a JavaCodeFragment with sourcecode that creates an instance of the datatype's Java class with the given expression.Returns"null".Methods inherited from class org.faktorips.codegen.dthelpers.AbstractDatatypeHelper
createCastExpression, getDatatype, getRangeJavaClassName, newEnumValueSetInstance, newEnumValueSetInstance, newInstanceFromExpression, newRangeInstance, newSafeCopy, referenceOrSafeCopyIfNeccessary, setDatatype, valueOfExpressionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.faktorips.codegen.DatatypeHelper
createCastExpression, getDatatype, getJavaClassName, getRangeJavaClassName, getValueSetJavaClassName, newEnumValueSetInstance, newEnumValueSetInstance, newInstance, newInstanceFromExpression, newRangeInstance, newValueInstance, referenceOrSafeCopyIfNeccessary, setDatatypeMethods inherited from interface org.faktorips.codegen.PrimitiveDatatypeHelper
getWrapperTypeHelper, toWrapper
-
Constructor Details
-
AbstractPrimitiveDatatypeHelper
public AbstractPrimitiveDatatypeHelper() -
AbstractPrimitiveDatatypeHelper
-
-
Method Details
-
newInstanceFromExpression
Description copied from interface:DatatypeHelperReturns a JavaCodeFragment with sourcecode that creates an instance of the datatype's Java class with the given expression. If the expression is null the fragment's sourcecode is either the String "null" or the sourcecode to get an instance of the appropriate null object. When evaluated the expression must return a string.- Specified by:
newInstanceFromExpressionin interfaceBaseDatatypeHelper<JavaCodeFragment>- Specified by:
newInstanceFromExpressionin interfaceDatatypeHelper- Overrides:
newInstanceFromExpressionin classAbstractDatatypeHelper- Parameters:
expression- A Java source code expression that yields a String. Examples are a constant String like"FOO", a variable likefooor a method call likegetÍd().
-
nullExpression
Description copied from class:AbstractDatatypeHelperReturns"null". Returns aJavaCodeFragmentwith sourcecode that is either the String "null" or the sourcecode to get an instance of the appropriate null object.- Specified by:
nullExpressionin interfaceBaseDatatypeHelper<JavaCodeFragment>- Specified by:
nullExpressionin interfaceDatatypeHelper- Overrides:
nullExpressionin classAbstractDatatypeHelper
-
newEnumValueSetInstance
public JavaCodeFragment newEnumValueSetInstance(JavaCodeFragment valueCollection, JavaCodeFragment containsNullExpression) -
newEnumValueSetInstance
-
getToStringExpression
Description copied from interface:DatatypeHelperReturns aJavaCodeFragmentcontaining the code for converting the value (of the given field) to a string representation with respect to its data type. The String must be built so that it can be read using the valueOf-Expression. If the value isnull, the toString-code will yieldnullas a result.The default implementation will call the values toString() method or return
null. The default implementation for generic (extensible) data types will call the method defined using setToStringMethodName(). CustomDatatypeHelpers may override.- Specified by:
getToStringExpressionin interfaceBaseDatatypeHelper<JavaCodeFragment>- Specified by:
getToStringExpressionin interfaceDatatypeHelper- Overrides:
getToStringExpressionin classAbstractDatatypeHelper- Parameters:
fieldName- the name of the field in the generated class that should be converted to a string- Returns:
- a
JavaCodeFragmentcontaining the toString() code.
-