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 ofSystemDataFormatterproviding to helper methods to ensure the presence of a value and the correctness of its type in the provided map.- Author:
- Patrick Schmidt
-
-
Constructor Summary
Constructors Constructor Description AbstractSystemDataFormatter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidensureCorrectType(ProcessConstants.AdeptDataType expectedType, String udtName, Serializable value)Throws anIllegalArgumentExceptionif the given object doesn't the specified data type and simply returns if it does.protected voidensureValuePresent(String parameterName, Map<String,? extends Serializable> parameterValues)Simply returns if the specified parameter value is present and throws anIllegalArgumentExceptionif it isn't.Stringformat(String parameterisedString, Map<String,Serializable> parameterValues)Formats the given parameterised string according to the needs of theSystemDataConsumerit is used by.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.aristaflow.adept2.model.common.systemdata.SystemDataFormatter
format
-
-
-
-
Method Detail
-
ensureValuePresent
protected void ensureValuePresent(String parameterName, Map<String,? extends Serializable> parameterValues)
Simply returns if the specified parameter value is present and throws anIllegalArgumentExceptionif it isn't.- Parameters:
parameterName- name of the parameterparameterValues- 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 benullthough)
-
ensureCorrectType
protected void ensureCorrectType(ProcessConstants.AdeptDataType expectedType, String udtName, Serializable value)
Throws anIllegalArgumentExceptionif the given object doesn't the specified data type and simply returns if it does.- Parameters:
expectedType- the expected data typeudtName- The name of the user-defined type if specified and known,nullotherwise.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:SystemDataFormatterFormats the given parameterised string according to the needs of theSystemDataConsumerit is used by.- Specified by:
formatin interfaceSystemDataFormatter- Parameters:
parameterisedString- the parameterised string to be formattedparameterValues- map containing values for all parameters referenced in the parameterised string- Returns:
- the formatted string
-
-