META-INF.xsd.smooks.javabean-1.1.xsd Maven / Gradle / Ivy
Smooks Java Binding Configuration
Javabean Bindings Configuration.
Bean Instance Creation
Instances of the class specified in the
"class" attribute are created and bound into
the bean context under the ID specified by
the "beanId" attribute. The bean instance is
created (and bound) when the element event
specified in the "createOnElement" attribute
is encountered in the Source data event
stream (see also "createOnElementNS").
Bean Property/Member Population
Bean property/member population is
controlled by the binding sub-elements
nested inside this element. Use your IDE to
discover these elements.
The ID under which the created bean is
to be bound in the bean context.
The fully qualified bean Class name.
The Source data event stream element
event to use to control the timing of
the creating.
Think of this as the element path (in
the Source data) used to control
creation of the bean instance(s).
Example
If this attribute value is set to
"order/orderItem", an instance of the
class (specified in the "class"
attribute) will be created when an
element event for the element
"orderItem" (with a parent element of
"order") is encountered in the Source
data event stream. The created bean
instance will then be bound into the
bean context under the specified
"beanId".
If the createOnElement is not set then
no bean will be created. The existing
bean in the bean context will be used to
do the value binding, expression binding
and the object wiring on.
Namespace control for the
"createOnElement" attribute.
Defines if this bindings bean wiring may still wire
beans after the element is processed. This enables
flat XML support.
The default value can be set with the global-parameter 'bean-population.default.extend.lifecycle'.
Default the value is 'false'.
Basic "value" based binding configuration.
This binding type is used to bind data from the source message event stream.
The class property to which the decoded data is to be bound.
The property attribute does not need to be specified when the "class" type on the parent "bindings" element
is a List/Array or Map. In the case of a List/Array, the bean is simply added. In the case of Map, the
element name (from the element specified in the "data" attribute) is used.
The class method which is called to bind the data
to the object. Not needed when binding to a Collection.
The setterMethod attribute does not need to be specified when the "class" type on the parent "bindings" element
is a List/Array or Map. In the case of a List/Array, the bean is simply added. In the case of Map, the
element name (from the element specified in the "data" attribute) is used.
The Source data event stream element event defining the data to be bound.
Think of this as the element path (in the Source data) to the data.
Examples
-
Element Text Data:
"order/orderid"
-
Element Attribute Data:
"order/header/@date"
Data Decoder.
This attribute specifies the
DataDecoder
to be used to decode the data (see "data" attribute) before setting it on the target bean
property(see "property" attribute).
Smooks contains decoders for all of the main data types (Long, Integer etc). In these cases,
just specify the decoder as being "Long", "Integer", "Date" etc i.e. no need to specify the fully qualified
DataDecoder
class name. The fully qualified class name is only required for custom
DataDecoder
implementations.
Primitive Types
Smooks does not define special decoders for any of the primitive types. To decode a
primitive property type, just specify the Object equivalent decoder e.g. specify "Integer" for "int",
"Double" for "double" etc etc.
Decode Parameters
Some decoders may require parameters in order to complete the decoding process e.g. the
DateDecoder.
These parameters can be specified by adding <decodeParam> sub-elements to the <value>
binding element. Review the Decoder's Javadoc for details of the custom parameters.
Example:
<jb:value property="date" data="header/date" decoder="Date">
<jb:decodeParam name="format">EEE MMM dd HH:mm:ss z yyyy</jb:decodeParam>
<jb:decodeParam name="locale-language">en</jb:decodeParam>
<jb:decodeParam name="locale-country">IE</jb:decodeParam>
</jb:value>
Custom Data Decoding
For custom data decoding, implement the
DataDecoder
interface and specify the decoder using the fully qualified class name of the new
implementation.
The default data value, where a null/empty data String is returned
for the data element.
The namespace for the "data" selector (see "data" attribute).
Wiring based binding configuration.
This binding type is used to "wire" beans together.
The class property to which the bean (specified
by "beanIdRef") is to be bound.
The property attribute does not need to be
specified when the "class" type on the parent
"bindings" element is a List/Array or Map. In
the case of a List/Array, the bean is simply
added. In the case of Map, the element name
(from the element specified in the "data"
attribute) is used.
The class method which is called to bind the data
to the object. Not needed when binding to a Collection.
The setterMethod attribute does not need to be specified when the "class" type on the parent "bindings" element
is a List/Array or Map. In the case of a List/Array, the bean is simply added. In the case of Map, the
element name (from the element specified in the "data" attribute) is used.
The beanId of the bean to be wired into the
specified bean "property" (or List).
The Source data event stream element event to
use to control when the bean needs to be wired
or when the cartridge needs to register a
listener for the bean to be wired.
Namespace control for the "wireOnElement"
attribute.
Expression based Configuration
The class property to which the expression evaluation result
is to be bound. Not needed when binding to a Collection.
The property attribute does not need to be specified when the "class" type on the parent "bindings" element
is a List/Array or Map. In the case of a List/Array, the bean is simply added. In the case of Map, the
element name (from the element specified in the "data" attribute) is used.
The class method which is called to bind the data
to the object. Not needed when binding to a Collection.
The setterMethod attribute does not need to be specified when the "class" type on the parent "bindings" element
is a List/Array or Map. In the case of a List/Array, the bean is simply added. In the case of Map, the
element name (from the element specified in the "data" attribute) is used.
The Source data event stream element event to use to control the execution of the expression
and binding of the result.
Think of this as the element path (in the Source data) used to control execution of the
expression.
Example
If this attribute value is set to "order/orderItem", the expression will be executed (and
the result bound to the target property) when an "end" element event ("visitAfter")
for the element "orderItem" (with a parent element of "order") is encountered in the
Source data event stream.
Namespace control for the "execOnElement" attribute.
Data Decode Parameter.
Some decoders may require parameters in order to complete the decoding process e.g. the
DateDecoder.
These parameters can be specified by adding <decodeParam> sub-elements to the <value>
binding element. Review the Decoder's Javadoc for details of the custom parameters.
Example:
<jb:value property="date" data="header/date" decoder="Date">
<jb:decodeParam name="format">EEE MMM dd HH:mm:ss z yyyy</jb:decodeParam>
<jb:decodeParam name="locale-language">en</jb:decodeParam>
<jb:decodeParam name="locale-country">IE</jb:decodeParam>
</jb:value>
The name of the parameter.