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 ofSystemDataFormatter
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 Summary
Constructors Constructor Description AbstractSystemDataFormatter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
ensureCorrectType(ProcessConstants.AdeptDataType expectedType, String udtName, Serializable value)
Throws anIllegalArgumentException
if the given object doesn't the specified data type and simply returns if it does.protected void
ensureValuePresent(String parameterName, Map<String,? extends Serializable> parameterValues)
Simply returns if the specified parameter value is present and throws anIllegalArgumentException
if it isn't.String
format(String parameterisedString, Map<String,Serializable> parameterValues)
Formats the given parameterised string according to the needs of theSystemDataConsumer
it 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 anIllegalArgumentException
if 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 benull
though)
-
ensureCorrectType
protected void ensureCorrectType(ProcessConstants.AdeptDataType expectedType, String udtName, Serializable value)
Throws anIllegalArgumentException
if 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,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 theSystemDataConsumer
it is used by.- Specified by:
format
in interfaceSystemDataFormatter
- Parameters:
parameterisedString
- the parameterised string to be formattedparameterValues
- map containing values for all parameters referenced in the parameterised string- Returns:
- the formatted string
-
-