org.apache.commons.betwixt.io.read
Class BeanBindAction

java.lang.Object
  extended byorg.apache.commons.betwixt.io.read.MappingAction
      extended byorg.apache.commons.betwixt.io.read.MappingAction.Base
          extended byorg.apache.commons.betwixt.io.read.BeanBindAction

public class BeanBindAction
extends MappingAction.Base

Action that creates and binds a new bean instance.

Version:
$Revision: 438373 $
Author:
Jakarta Commons Team

Nested Class Summary
 
Nested classes inherited from class org.apache.commons.betwixt.io.read.MappingAction
MappingAction.Base
 
Field Summary
static BeanBindAction INSTANCE
          Singleton instance
 
Fields inherited from class org.apache.commons.betwixt.io.read.MappingAction
EMPTY, IGNORE
 
Constructor Summary
BeanBindAction()
           
 
Method Summary
 MappingAction begin(java.lang.String namespace, java.lang.String name, org.xml.sax.Attributes attributes, ReadContext context)
          Begins a new element which is to be bound to a bean.
 void body(java.lang.String text, ReadContext context)
          Executes mapping action for element body text
protected  java.lang.Object createBean(java.lang.String namespace, java.lang.String name, org.xml.sax.Attributes attributes, ElementDescriptor descriptor, ReadContext context)
          Factory method to create new bean instances
 void end(ReadContext context)
          Executes mapping action one element ends
private  ElementDescriptor getElementDescriptor(ElementDescriptor propertyDescriptor, ReadContext context)
          Allows the navigation from a reference to a property object to the descriptor defining what the property is.
private  void update(ReadContext context, java.lang.Object value)
           
 
Methods inherited from class org.apache.commons.betwixt.io.read.MappingAction.Base
next
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final BeanBindAction INSTANCE
Singleton instance

Constructor Detail

BeanBindAction

public BeanBindAction()
Method Detail

begin

public MappingAction begin(java.lang.String namespace,
                           java.lang.String name,
                           org.xml.sax.Attributes attributes,
                           ReadContext context)
                    throws java.lang.Exception
Begins a new element which is to be bound to a bean.

Overrides:
begin in class MappingAction.Base
Throws:
java.lang.Exception
See Also:
MappingAction.begin(String, String, Attributes, ReadContext)

body

public void body(java.lang.String text,
                 ReadContext context)
          throws java.lang.Exception
Description copied from class: MappingAction
Executes mapping action for element body text

Overrides:
body in class MappingAction.Base
Throws:
java.lang.Exception
See Also:
MappingAction.body(String, ReadContext)

end

public void end(ReadContext context)
         throws java.lang.Exception
Description copied from class: MappingAction
Executes mapping action one element ends

Overrides:
end in class MappingAction.Base
Throws:
java.lang.Exception
See Also:
MappingAction.end(ReadContext)

update

private void update(ReadContext context,
                    java.lang.Object value)
             throws java.lang.Exception
Throws:
java.lang.Exception

createBean

protected java.lang.Object createBean(java.lang.String namespace,
                                      java.lang.String name,
                                      org.xml.sax.Attributes attributes,
                                      ElementDescriptor descriptor,
                                      ReadContext context)
Factory method to create new bean instances

Parameters:
namespace - the namespace for the element
name - the local name
attributes - the Attributes used to match ID/IDREF
Returns:
the created bean

getElementDescriptor

private ElementDescriptor getElementDescriptor(ElementDescriptor propertyDescriptor,
                                               ReadContext context)
Allows the navigation from a reference to a property object to the descriptor defining what the property is. i.e. doing the join from a reference to a type to lookup its descriptor. This could be done automatically by the NodeDescriptors. Refer to TODO.txt for more info.

Parameters:
propertyDescriptor - find descriptor for property object referenced by this descriptor
Returns:
descriptor for the singular property class type referenced.