public interface IlvValueFilter
IlvValueFilter
object is called by the class
IlvValueConverter
to convert a value from one type to another.
A single IlvValueFilter
can handle one or more source and target
types.
There is a number of predefined filters that convert values from one of the Java primitive types to another.
Additional value filters can be defined with the method
IlvValueConverter.registerFilter
.
Modifier and Type | Method and Description |
---|---|
Object |
convert(Object value,
Class<?> toType)
Converts the specified value to the given type.
|
Class<?>[] |
fromTypes()
Returns the source types that this filter can handle, that is, the types
that can be converted to the target types declared by
toTypes . |
Class<?>[] |
toTypes()
Returns the target types that this filter can handle, that is, the types to
which the source types declared by
fromTypes can be converted. |
Class<?>[] fromTypes()
toTypes
.Class<?>[] toTypes()
fromTypes
can be converted.Object convert(Object value, Class<?> toType) throws IlvValueException
The converted value
will be of one of the types returned by
fromTypes
. All other combinations of source/target types
declared by fromTypes
/toTypes
should be handled
by this method.
If the operation fails, this method must throw an exception of type
IlvValueException
.
value
- the value to be converted.toType
- the target type.IlvValueException
- if the value could not be converted to the requested type.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.