org.carrot2.util.attribute
Class AttributeBinderInjector

java.lang.Object
  extended by org.carrot2.util.attribute.AttributeBinderInjector

public class AttributeBinderInjector
extends Object

A very simple field value injector based on the AttributeBinder. The injector can recursively inject values to the designated non-static fields of the root injection receiver object. Such an injector can be useful to set references to common resources (e.g. internal processing contexts) on an object hierarchy.


Constructor Summary
AttributeBinderInjector()
           
 
Method Summary
static void injectByType(Class<? extends Annotation> injectableMarker, Map<Class<?>,Object> values, Object... objects)
          Injects values to an object's non-static fields by value type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeBinderInjector

public AttributeBinderInjector()
Method Detail

injectByType

public static void injectByType(Class<? extends Annotation> injectableMarker,
                                Map<Class<?>,Object> values,
                                Object... objects)
Injects values to an object's non-static fields by value type.

Parameters:
injectableMarker - a marker interface that designates injection receivers
values - a mapping between field type and the value to set, null values are allowed and will be transferred to the object's fields. If the map does not contain a key equal an object field's type, the field's value will not be changed.
objects - All objects whose fields should be set. Objects must be marked with the injectableMarker annotation. All objects' fields whose types are marked with the injectableMarker will also recursively receive value injection.


Copyright (c) Dawid Weiss, Stanislaw Osinski