This {@link Descriptor} creates and initializes an object.Objects can be instantiated from a constructor or from a method invocation.
The way to create an object is specified one of these methods (see creating objects):
This method is used when {@link #getClassName()}!=null && {@link #getMethodName()}==null
.
The {@link #construct(WireContext)} method creates a new objectfrom a constructor matching the given arguments (specified with {@link #setArgDescriptors(List)}).
The name of the method to call is specified by the method attribute.
{@link #getFactoryObjectName()}!=null
: the object with the name factoryObjectName will be fetched from the context. {@link #getFactoryDescriptor()}!=null
: the object will be created from the factory descriptor.The object returned by {@link #construct(WireContext)} is the object returned by the method invocation.
If the auto wiring is enabled for the object ( {@link #isAutoWireEnabled()}==true
), the WireContext will try to look for objects with the same name as the fields in the class. If it finds an object with that name, and if it is assignable to the field's type, it is automatically injected, without the need for explicit {@link FieldOperation} that specifies the injection in the wiring xml.
If the auto wiring is enabled and the WireContext finds an object with the name of a field, but not assignable to this field, a warning message is generated.
Auto-wiring is disabled by default.
Field injection or property injection are done after the auto-wiring. For more information, see {@link Operation}.
If a field was injected by auto-wiring, its value can be overridden by specifying a {@link FieldOperation} or {@link PropertyOperation} operation.
@author Tom Baeyens @author Guillaume Porcher (documentation)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|