|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jbpm.wire.binding.ObjectBinding
public class ObjectBinding
This Binding
specifies a ObjectDescriptor
(to create an object).
Objects can be instantiated from a constructor or from a method invocation.
An object descriptor is defined by a <object>
element.
This element can have an attribute "name", which specifies the name of the created object in the WireContext.
This element can have an attribute "auto-wire", which specifies if auto-wire is enabled (see Auto Wiring)
The method to create the object is specified with one of these methods (see creating objects):
The method attribute specifies a method to call on the object. If the method is called on a previously created object, the access to this object is specified by the "factory" element or attribute. If the method is static, the class is specified by the "class" attribute. The arguments are taken from the <arg> children elements.
This method uses the "class" attribute.
The constructor is specified by the <constructor> element. It contains a list of <arg> elements, which are the arguments to give to the constructor.
the method attribute must not be used if the <constructor> element is specified.
public class Foo { String bar; public Foo(String text) { bar = text; } }The following Xml declaration will create an object 'o' of class 'Foo'. The object will be constructed by calling
new Foo("hello")
.
<objects> <object name='o' class='Foo'> <constructor> <arg> <string value='hello' /> </arg> </constructor> </object> </objects>
The name of the method to call is specified by the method attribute.
The object constructed by the resulting ObjectDescriptor
is the object returned by the call to the specified method.
If the auto wiring is enabled for the object (the attribute "auto-wire" is set to "true", "enabled" or "on"), 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 <field> tag 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 (if no auto-wire attribute is found, a default value "auto-wire=disabled" is used).
Field injection or property injection are done after the auto-wiring. For more information, see Operation
.
If a field was injected by auto-wiring, its value can be overridden by specifying a <field> or <property> operation.
Known Xml tags to specify an Operation
:
<property .../>
: see PropertyBinding
<field .../>
: see FieldBinding
<invoke .../>
: see InvokeBinding
<subscribe .../>
: see SubscribeBinding
<enlist .../>
: see EnlistBinding
WireParser
Constructor Summary | |
---|---|
ObjectBinding()
|
Method Summary | |
---|---|
java.lang.Object |
parse(org.w3c.dom.Element element,
Parse parse,
Parser parser)
translates the given element into a domain model java object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectBinding()
Method Detail |
---|
public java.lang.Object parse(org.w3c.dom.Element element, Parse parse, Parser parser)
Binding
parse
in interface Binding
Parser
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |