Class AbstractSystemDataFormatter

java.lang.Object
de.aristaflow.adept2.model.common.systemdata.AbstractSystemDataFormatter
All Implemented Interfaces:
SystemDataFormatter
Direct Known Subclasses:
BasicSystemDataFormatter, LongDateSystemDataFormatter, OrgPolicySystemDataFormatter

public abstract class AbstractSystemDataFormatter extends Object implements SystemDataFormatter
An abstract implementation of SystemDataFormatter providing to helper methods to ensure the presence of a value and the correctness of its type in the provided map.
Author:
Patrick Schmidt
  • Constructor Details

    • AbstractSystemDataFormatter

      public AbstractSystemDataFormatter()
  • Method Details

    • ensureValuePresent

      protected void ensureValuePresent(String parameterName, Map<String,? extends Serializable> parameterValues)
      Simply returns if the specified parameter value is present and throws an IllegalArgumentException if it isn't.
      Parameters:
      parameterName - name of the parameter
      parameterValues - map containing the parameter values
      Throws:
      IllegalArgumentException - if the value is not present (i.e. the key is missing in the map; the value may be null though)
    • ensureCorrectType

      protected void ensureCorrectType(ProcessConstants.AdeptDataType expectedType, String udtName, Serializable value)
      Throws an IllegalArgumentException if the given object doesn't the specified data type and simply returns if it does.
      Parameters:
      expectedType - the expected data type
      udtName - The name of the user-defined type if specified and known, null otherwise.
      value - the value object
      Throws:
      IllegalArgumentException - if the object's type doesn't match the expected data type
    • format

      public String format(String parameterisedString, Map<String,Serializable> parameterValues)
      Description copied from interface: SystemDataFormatter
      Formats the given parameterised string according to the needs of the SystemDataConsumer it is used by.
      Specified by:
      format in interface SystemDataFormatter
      Parameters:
      parameterisedString - the parameterised string to be formatted
      parameterValues - map containing values for all parameters referenced in the parameterised string
      Returns:
      the formatted string