org.milyn.javabean.dynamic
Class BeanMetadata

java.lang.Object
  extended by org.milyn.javabean.dynamic.BeanMetadata

public class BeanMetadata
extends Object

Bean metadata.

This class is used to hold additional data about a model bean instance.

Author:
tom.fennelly@gmail.com

Constructor Summary
BeanMetadata(Object bean)
          Public constructor.
 
Method Summary
 Object getBean()
          Get the bean instance with which this metadata instance is associated.
 org.milyn.delivery.Fragment getCreateSource()
          Get the source Fragment that created the bean instance.
 String getNamespace()
          Get the XML namespace with which the associated bean instance is associated.
 String getNamespacePrefix()
          Get the XML namespace prefix.
 List<org.milyn.delivery.Fragment> getPopulateSources()
          Get the "population" fragments that contributed data to the bean instance (set data on it's properties).
 String getPreText()
          Get the "pre text" associated with the bean.
 Map<Object,Object> getProperties()
          Get user properties/metadata associated with the bean.
 BeanWriter getWriter()
          Get the BeanWriter instance to be used to serialize the bean instance.
 BeanMetadata setCreateSource(org.milyn.delivery.Fragment createSource)
          Set the source Fragment that created the bean instance.
 BeanMetadata setNamespace(String namespace)
          Set the XML namespace with which the associated bean instance is associated.
 BeanMetadata setNamespacePrefix(String namespacePrefix)
          Set the XML namespace prefix.
 BeanMetadata setPreText(String preText)
          Set the "pre text" associated with the bean.
 BeanMetadata setWriter(BeanWriter writer)
          Set the BeanWriter instance to be used to serialize the bean instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanMetadata

public BeanMetadata(Object bean)
Public constructor.

Parameters:
bean - The bean instance.
Method Detail

getBean

public Object getBean()
Get the bean instance with which this metadata instance is associated.

Returns:
The bean instance.

getNamespace

public String getNamespace()
Get the XML namespace with which the associated bean instance is associated.

Returns:
The XML namespace with which the bean instance is associated.
See Also:
setNamespace(String), setNamespacePrefix(String), getNamespacePrefix()

setNamespace

public BeanMetadata setNamespace(String namespace)
Set the XML namespace with which the associated bean instance is associated.

If the bean instance was created from a source XML message, the namespace will be set from the namespace of the source XML. If the bean instance was created and registered manually on the Model, the default namepsace is set (can be reset).

Parameters:
namespace - The XML namespace with which the bean instance is associated.
Returns:
this BeanMetadata instance.
See Also:
getNamespace(), setNamespacePrefix(String), getNamespacePrefix()

getNamespacePrefix

public String getNamespacePrefix()
Get the XML namespace prefix.

Returns:
The XML namespace prefix.
See Also:
setNamespace(String), getNamespace(), setNamespacePrefix(String)

setNamespacePrefix

public BeanMetadata setNamespacePrefix(String namespacePrefix)
Set the XML namespace prefix.

If the bean instance was created from a source XML message, the prefix will be set from the prefix of the source XML. If the bean instance was created and registered manually on the Model, the default namepsace prefix is set (can be reset).

Parameters:
namespacePrefix - The XML namespace prefix.
Returns:
this BeanMetadata instance.
See Also:
setNamespace(String), getNamespace(), getNamespacePrefix()

getPreText

public String getPreText()
Get the "pre text" associated with the bean.

When a Model is created/read from a source XML message, the different fragments in the source message are responsible for triggering creation of beans that go into the Model instance. The "pre text" of a bean is the XML whitespace, comments, CDATA and non contributing XML that precedes the XML fragment that created the bean. This is an ad-hoc mechanism for maintaining user comments etc.

Returns:
The "pre text".

setPreText

public BeanMetadata setPreText(String preText)
Set the "pre text" associated with the bean.

When a Model is created/read from a source XML message, the different fragments in the source message are responsible for triggering creation of beans that go into the Model instance. The "pre text" of a bean is the XML whitespace, comments, CDATA and non contributing XML that precedes the XML fragment that created the bean. This is an ad-hoc mechanism for maintaining user comments etc.

Parameters:
preText - The "pre text".
Returns:
this BeanMetadata instance.

getWriter

public BeanWriter getWriter()
Get the BeanWriter instance to be used to serialize the bean instance.

Returns:
The BeanWriter instance to be used to serialize the bean instance, or null if no BeanWriter instance is configured for the bean type and namespace combination.

setWriter

public BeanMetadata setWriter(BeanWriter writer)
Set the BeanWriter instance to be used to serialize the bean instance.

Parameters:
writer - The BeanWriter instance to be used to serialize the bean instance.
Returns:
this BeanMetadata instance.

setCreateSource

public BeanMetadata setCreateSource(org.milyn.delivery.Fragment createSource)
Set the source Fragment that created the bean instance.

Parameters:
createSource - The source fragment.
Returns:
this BeanMetadata instance.

getCreateSource

public org.milyn.delivery.Fragment getCreateSource()
Get the source Fragment that created the bean instance.

Returns:
The source fragment, or null if the bean was not created from a source fragment (may have been manually constructed and added to the model).

getPopulateSources

public List<org.milyn.delivery.Fragment> getPopulateSources()
Get the "population" fragments that contributed data to the bean instance (set data on it's properties).

Returns:
The list of "population" fragments. An empty List is returned if no "population" fragments were recorded.

getProperties

public Map<Object,Object> getProperties()
Get user properties/metadata associated with the bean.

A mechanism for associating additional "user defined" metadata.

Returns:
The user properties/metadata associated with the bean.


Copyright © 2018. All rights reserved.