|
com.im.df.api 5.9 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface DFDataConvertor
This class is supposed to handle conversion to a certain data type from
multiple formats. The Convertor can be parametrized using the Options bean,
which can be obtained from the createOptions(). If createOptions returns
null, no options are supported at all. In such case, the convert(java.lang.Object, java.lang.Object)
method may ignore whatever options are passed.
It is an error to pass an options instance to the checkDataAcceptance(java.lang.Object, java.lang.Object)
or convert(java.lang.Object, java.lang.Object), which was not created using createOptions(). The
methods will throw an IllegalArgumentException in such case.
The convert(java.lang.Object, java.lang.Object) method may return null for neutral values of the input data.
The convert(java.lang.Object, java.lang.Object) may throw an IllegalArgumentException to indicate the input
data is not valid.
| Method Summary | |
|---|---|
boolean |
checkDataAcceptance(Object value,
Object options)
Acknowledges that the Converter can work with the passed data. |
Object |
convert(Object value,
Object options)
Converts the value. |
Object |
convert(Object value,
Object options,
List<String> messages)
Converts the value. |
Object |
createOptions()
Returns an option bean for the conversion. |
| Method Detail |
|---|
boolean checkDataAcceptance(Object value,
Object options)
null can be always accepted, but is converted to null, but it depends
on each convertor implementation - this is not guaranteed.
value - The value to be convertedoptions - Optional options object. Can be null for the default conversion
convert(java.lang.Object, java.lang.Object) method.
Object convert(Object value,
Object options)
value - The value to convert. Can be null (if checkDataAcceptance(java.lang.Object, java.lang.Object)
returned true, but then null is typically returned. It also depends on convertor implementation.options - The conversion options, or null for the default behaviour
null.
IllegalArgumentException - when value is not valid.
Object convert(Object value,
Object options,
List<String> messages)
createOptions().
The method will throw an IllegalArgumentException, if the passed
value is of unsupported type (first check using checkDataAcceptance(java.lang.Object, java.lang.Object),
or the value is invalid.
value - The value to convert. Can be null (if checkDataAcceptance(java.lang.Object, java.lang.Object)
returned true, but then null is typically returned. It also depends on convertor implementation.options - The conversion options, or null for the default behaviourmessages - Allows messages to be reported to user by being added to this list. Can be null.
null.
IllegalArgumentException - when value is not valid.Object createOptions()
null, the converter does not support any options at all.
|
com.im.df.api 5.9 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||