com.planetalia.dynject.conversion
Interface IConverter
- All Known Implementing Classes:
- BigDecimalAssigner, BigIntegerAssigner, ByteAssigner, DateAssigner, DoubleAssigner, EnumAssigner, FloatAssigner, IntAssigner, LongAssigner, PrimitiveDecimalAssigner, PrimitiveIntegralAssigner, ShortAssigner, StringAssigner, StringBufferAssigner, StringBuilderAssigner, StringConstructorAssigner
public interface IConverter
The IConverter interface represents the minimum functionality that anyone whising to intervene in the
conversion process must be able to provide. All Converters are assumed to be reentrant and
thread-safe and stateless (at any given time, a converter instance may be replaced
by another one from the same class, and this should have no impact on operations).
Connverter instances are usually reused to minimize memory impact.
- Author:
- Alexander Hristov
convert
java.lang.Object convert(Configuration cfg,
Environment env,
java.lang.Object data,
java.lang.Class targetClass)
- Main processing method. Performs whatever conversion the Converter wants to do.
All parameters including data are guaranteed to be non-null.
- Parameters:
cfg - The compile-time configuration of the field, specified through annotation values.env - The runtime environment of the conversion process
Runtime environment values override compile-time configuration.
data - The data value that must be processedtargetClass - - The required destination class.
- Returns:
- The conversion result. The returned object MUST either be of the
targetClass if the conversion was possible, or it must be null if conversion was
not possible.
- Throws:
HandlerException - This exception must be thrown in case of any failure.