com.planetalia.dynject.injection
Interface IDataHandler

All Known Implementing Classes:
CreditCardImpl, DataHandlerSupport, EuropeanVATImpl, FileSpecImpl, ISBNImpl, IsBooleanImpl, IsDateImpl, IsNumericImpl, IsTimeImpl, IsTimestampImpl, IsURLImpl, LengthImpl, MaxDigitsImpl, MaxExclusiveImpl, MaxFractionDigitsImpl, MaxInclusiveImpl, MinDigitsImpl, MinExclusiveImpl, MinInclusiveImpl, NormalizedImpl, PatternImpl, RequiredImpl, SimplifyImpl, ValueConstraintImpl

public interface IDataHandler

The DataHandler interface represents the minimum functionality that anyone whising to intervene in the data processing pipeline must be able to provide. All Data handlers are assumed to be reentrant and thread-safe and stateless (at any given time, a data handler instance may be replaced by another one from the same class, and this should have no impact on operations).

Data Handler instances are usually reused to minimize memory impact.

Author:
Alexander Hristov

Method Summary
 java.lang.Object process(Configuration cfg, Environment env, ErrorMap errors, java.lang.String name, java.lang.Object instance, java.lang.Object data, ClassPreferences preferredOutputClasses)
          Main processing method.
 

Method Detail

process

java.lang.Object process(Configuration cfg,
                         Environment env,
                         ErrorMap errors,
                         java.lang.String name,
                         java.lang.Object instance,
                         java.lang.Object data,
                         ClassPreferences preferredOutputClasses)
                         throws HandlerException
Main processing method. Performs whatever action the DataHandler wants to do. All parameters except 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.

errors - The global of error messages accumulated so far.

name - The field name (real or 'virtual') that this operation is being executed upon. If the original annotations where placed on a field, it will contain its name. If they were placed on a getter/setter, it will contain the name of the method minus the "get/set/is" part, with the first leter lowercased.
For example, if the annotation was placed on getName(), fieldName will contain only "name"

instance - The instance to which the field or method belongs.
data - The data value that must be processed
preferredOutputClasses - - The list of classes that are preferred as an output for this operation. Guaranteed to contain at least on object, although it may be Object.class if there are no specific preferences. The handling class is free to ignore the preferences, and there should be no consequences of this further down the chain (other than the inability to perform a conversion at some specific step). For performance reasons the handling class is handled a reference - rather than a copy - of someone else's list, and should abstain from modifying it.
Returns:
The processed piece of data.
Throws:
HandlerException - This exception must be thrown in case of any failure.