public interface ValueHandler
The main purpose for the ValueHandler is when your input value cannot be simply mapped to a field in the business object. For example, if in the input, you only have a logon ID, but in the business object, you only have a field which expects the user internal unique ID. You need a value handler to resolve the user internal unique ID based on the input logon ID. Another example is that if your input data contain Y or N, but the business object field expects true or false. You can have a value handler to convert Y to true and N to false.
The BusinessObjectBuilder will only create one instance of the implementation class if the same implementation class is specified in more than one places in the BusinessObjectBuilder configuration. So the resolveValue() method resolving value should only depend on the input parameters, not on the position you defined in the configuration file.
When defining the value handler in the configuration, it can associate with a list of parameters which are name-value pairs. These name value pairs will be passed to the resolveValue method as a parameter map.
All implementation classes should extend from the AbstractValueHandler class.
AbstractValueHandler
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM Copyright notice field.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the class to release any resources it used.
|
void |
init()
Initializes the instance.
|
java.lang.String |
resolveValue(java.lang.String inputValue,
java.util.Map<java.lang.String,java.lang.String> parameterMap,
java.lang.Object dataObject)
Resolve the value based on the input value and parameters passed in.
|
static final java.lang.String COPYRIGHT
void init() throws DataLoadException
DataLoadException
- if there are some errors.java.lang.String resolveValue(java.lang.String inputValue, java.util.Map<java.lang.String,java.lang.String> parameterMap, java.lang.Object dataObject) throws DataLoadException
inputValue
- an input valueparameterMap
- a parameter map is name-value pairs defined in the
configuration.dataObject
- the current business object being populated.DataLoadException
- if there are some errors to resolve the
value.void close()