|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.gdata.server.registry.configuration.PropertyInjector
public class PropertyInjector
PropertyInjector is used to set member variables / properties of classes via
setter methods using the
ComponentConfiguration
class.
To populate a object with properties from a ComponentConfiguration instance
the class or a superclass of the object to populate has to provide at least
one setter method with a single parameter. The object to populate is set via
the setTargetObject(java.lang.Object)
method. The class of the object
will be analyzed for setter methods having a "set" prefix in their method
name. If one of the found setter methods is annotated with
Requiered
this
property is interpreted as a mandatory property. Mandatory properties must be
available in the provided ComponentConfiguration, if not the injection will
fail.
The
ComponentConfiguration
contains key / value pairs where the key must match the signature of the
setter method without the 'set' prefix and must begin with a lower case
character. KeybufferSize
does match a method signature
of setBufferSize
The type of the parameter will be
reflected via the Reflection API and instantiated with the given value if
possible.
Setter methods without a Required
annotation will be set if
the property is present in the ComponentConfiguration
This class does not support overloaded setter methods.
Requiered
,
ComponentConfiguration
Constructor Summary | |
---|---|
PropertyInjector()
|
Method Summary | |
---|---|
void |
clear()
Sets all members to their default values and clears the internal used Map instances |
protected int |
getOptionalSize()
|
protected int |
getRequiredSize()
|
void |
injectProperties(ComponentConfiguration bean)
Injects the properties stored in the ComponentConfiguration
to the corresponding methods of the target object |
void |
setTargetObject(Object o)
Sets the object to be populated with the properties provided in the ComponentConfiguration. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertyInjector()
Method Detail |
---|
public void setTargetObject(Object o)
o
- - the object to populateprotected int getRequiredSize()
protected int getOptionalSize()
public void injectProperties(ComponentConfiguration bean)
ComponentConfiguration
to the corresponding methods of the target object
bean
- - configuration bean containing all properties to set.public void clear()
Map
instances
Map.clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |