Class MoneyHelper

All Implemented Interfaces:
BaseDatatypeHelper<JavaCodeFragment>, DatatypeHelper

public class MoneyHelper extends AbstractDatatypeHelper
  • Constructor Details

    • MoneyHelper

      public MoneyHelper()
      Constructs a new helper.
    • MoneyHelper

      public MoneyHelper(MoneyDatatype datatype)
      Constructs a new helper for the given money datatype.
      Throws:
      IllegalArgumentException - if datatype is null.
  • Method Details

    • getJavaClassName

      public String getJavaClassName()
      Description copied from interface: DatatypeHelper
      Returns the qualified Java class name the datatype represents.
    • newInstance

      public JavaCodeFragment newInstance(String value)
      Description copied from interface: DatatypeHelper
      Returns a JavaCodeFragment with sourcecode that creates an instance of the datatype's Java class with the given value. If the value is null the fragment's sourcecode is either the String "null" or the sourcecode to get an instance of the appropriate null object.
    • valueOfExpression

      protected JavaCodeFragment valueOfExpression(String expression)
      Description copied from class: AbstractDatatypeHelper
      This method is supposed to be overridden by subclasses.

      It is used within the newInstanceFromExpression(String) method. It returns 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. Preconditions: Expression may not be null or empty. When evaluated the expression must return a String.

      Specified by:
      valueOfExpression in class AbstractDatatypeHelper
    • newInstanceFromExpression

      public JavaCodeFragment newInstanceFromExpression(String expression)
      Methode der Oberklasse wird ueberschrieben, weil bei diesem Datentyp valueOf-Methode selbst Null-Expression zurueckgeben kann
      Specified by:
      newInstanceFromExpression in interface BaseDatatypeHelper<JavaCodeFragment>
      Specified by:
      newInstanceFromExpression in interface DatatypeHelper
      Overrides:
      newInstanceFromExpression in class AbstractDatatypeHelper
      Parameters:
      expression - A Java source code expression that yields a String. Examples are a constant String like "FOO", a variable like foo or a method call like getÍd().
    • nullExpression

      public JavaCodeFragment nullExpression()
      Description copied from class: AbstractDatatypeHelper
      Returns "null". Returns a JavaCodeFragment with sourcecode that is either the String "null" or the sourcecode to get an instance of the appropriate null object.
      Specified by:
      nullExpression in interface BaseDatatypeHelper<JavaCodeFragment>
      Specified by:
      nullExpression in interface DatatypeHelper
      Overrides:
      nullExpression in class AbstractDatatypeHelper
    • getRangeJavaClassName

      public String getRangeJavaClassName(boolean useTypesafeCollections)
      Description copied from interface: DatatypeHelper
      Returns the qualified Java class name of the range class of the datatype this is a helper for.
      Specified by:
      getRangeJavaClassName in interface DatatypeHelper
      Overrides:
      getRangeJavaClassName in class AbstractDatatypeHelper
    • newRangeInstance

      public JavaCodeFragment newRangeInstance(JavaCodeFragment lowerBoundExp, JavaCodeFragment upperBoundExp, JavaCodeFragment stepExp, JavaCodeFragment containsNullExp, boolean useTypesafeCollections)
      Description copied from interface: DatatypeHelper
      Returns a JavaCodeFragment containing the source code to create a new instance of a type specific range.
      Specified by:
      newRangeInstance in interface DatatypeHelper
      Overrides:
      newRangeInstance in class AbstractDatatypeHelper
      Parameters:
      lowerBoundExp - the lower bound expression of the range. Can be null to indicate that the lower bound is open
      upperBoundExp - the upper bound expression of the range. Can be null to indicate that the upper bound is open.
      stepExp - the minimum increment expression for values within the lower and upper bounds. Can be null to indicate that this is a continuous range.
      containsNullExp - the containsNull expression
      Returns:
      the code fragment to create a new range instance. Can be null to indicate that a range is not supported.