org.enhydra.xml.xmlc.dom.generic
Class GenericAccessorGenerator

java.lang.Object
  |
  +--org.enhydra.xml.xmlc.dom.generic.GenericAccessorGenerator
All Implemented Interfaces:
AccessorGenerator
Direct Known Subclasses:
DeferredParsingAccessorGenerator, LazyDOMAccessorGenerator

public class GenericAccessorGenerator
extends Object
implements AccessorGenerator

Generate access methods for a DOM only using the W3C DOM. Many methods in the class are protected so it can be used as a base for other AccessorGenerator classes.


Constructor Summary
GenericAccessorGenerator()
           
 
Method Summary
 void createAccessMethodInit(ElementInfo elementInfo, String elementVarName, JavaCode body)
          Create code to setup an access method for an element when building the DOM.
 JavaMethod createAccessorMethod(ElementInfo elementInfo, ElementInfo.AccessorInfo accessor, boolean createDelegation, JavaClass docClass)
          Create an element accessor method (getElementXXX() or getTextXXX()).
 void createNullElementAccess(ElementInfo elementInfo, JavaCode body)
          Create code cached information so that element access methods return null.
 void createResetElementAccess(ElementInfo elementInfo, String nodeVarName, JavaCode body)
          Create code to reset the element access information from a node.
 JavaMethod createSetTextMethod(ElementInfo elementInfo, boolean createDelegation, JavaClass docClass)
          Create the setText method for an element.
protected  String getElementField(ElementInfo elementInfo)
          Get the name of the field that will store an element.
protected  JavaMethod setupGetElementMethod(ElementInfo elementInfo, ElementInfo.AccessorInfo accessor, boolean createDelegation, JavaClass docClass)
          Set up a accessor (getElementXXX or getTagXXX) method object for an element.
protected  JavaMethod setupSetTextMethod(ElementInfo elementInfo, boolean createDelegation, JavaClass docClass)
          Setup the setText method for an element.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericAccessorGenerator

public GenericAccessorGenerator()
Method Detail

getElementField

protected String getElementField(ElementInfo elementInfo)
Get the name of the field that will store an element.

createAccessMethodInit

public void createAccessMethodInit(ElementInfo elementInfo,
                                   String elementVarName,
                                   JavaCode body)
Create code to setup an access method for an element when building the DOM.
Specified by:
createAccessMethodInit in interface AccessorGenerator
See Also:
AccessorGenerator.createAccessMethodInit(org.enhydra.xml.xmlc.compiler.ElementInfo, java.lang.String, org.enhydra.xml.xmlc.codegen.JavaCode)

createNullElementAccess

public void createNullElementAccess(ElementInfo elementInfo,
                                    JavaCode body)
Create code cached information so that element access methods return null.
Specified by:
createNullElementAccess in interface AccessorGenerator
See Also:
AccessorGenerator.createNullElementAccess(org.enhydra.xml.xmlc.compiler.ElementInfo, org.enhydra.xml.xmlc.codegen.JavaCode)

createResetElementAccess

public void createResetElementAccess(ElementInfo elementInfo,
                                     String nodeVarName,
                                     JavaCode body)
Create code to reset the element access information from a node.
Specified by:
createResetElementAccess in interface AccessorGenerator
See Also:
AccessorGenerator.createResetElementAccess(org.enhydra.xml.xmlc.compiler.ElementInfo, java.lang.String, org.enhydra.xml.xmlc.codegen.JavaCode)

setupGetElementMethod

protected JavaMethod setupGetElementMethod(ElementInfo elementInfo,
                                           ElementInfo.AccessorInfo accessor,
                                           boolean createDelegation,
                                           JavaClass docClass)
Set up a accessor (getElementXXX or getTagXXX) method object for an element. Creates the method, documentation, and delegate check code.

createAccessorMethod

public JavaMethod createAccessorMethod(ElementInfo elementInfo,
                                       ElementInfo.AccessorInfo accessor,
                                       boolean createDelegation,
                                       JavaClass docClass)
Create an element accessor method (getElementXXX() or getTextXXX()).
Specified by:
createAccessorMethod in interface AccessorGenerator
See Also:
AccessorGenerator.createAccessorMethod(org.enhydra.xml.xmlc.compiler.ElementInfo, org.enhydra.xml.xmlc.compiler.ElementInfo.AccessorInfo, boolean, org.enhydra.xml.xmlc.codegen.JavaClass)

setupSetTextMethod

protected JavaMethod setupSetTextMethod(ElementInfo elementInfo,
                                        boolean createDelegation,
                                        JavaClass docClass)
Setup the setText method for an element. Creates the method, documentation, and delegate check code.

createSetTextMethod

public JavaMethod createSetTextMethod(ElementInfo elementInfo,
                                      boolean createDelegation,
                                      JavaClass docClass)
Create the setText method for an element.
Specified by:
createSetTextMethod in interface AccessorGenerator
See Also:
AccessorGenerator.createSetTextMethod(org.enhydra.xml.xmlc.compiler.ElementInfo, boolean, org.enhydra.xml.xmlc.codegen.JavaClass)


Copyright © 1999-2002 enhydra.org (Mark Diekhans, David Li, Richard Kunze). All Rights reserved.