org.jbind.xml.schema.compiler
Class DataCartridge

java.lang.Object
  extended byorg.jbind.xml.schema.cmp.ComponentVisitor
      extended byorg.jbind.xml.schema.compiler.AbstractCartridge
          extended byorg.jbind.xml.schema.compiler.BaseCartridge
              extended byorg.jbind.xml.schema.compiler.DataCartridge
All Implemented Interfaces:
IBinder, ICartridge, IComponentVisitor
Direct Known Subclasses:
DataClassCartridge, DataInterfaceCartridge

public abstract class DataCartridge
extends BaseCartridge


Nested Class Summary
protected static class DataCartridge.RefConstraintInfo
           
 
Constructor Summary
DataCartridge(java.lang.String aCartridgeAttributePrefix, java.lang.String aNamePrefix, java.lang.String aNameSuffix)
           
 
Method Summary
protected abstract  java.lang.String attributeChecker(IAnyType aType, IAttrRefOrDecl aRefOrDecl, MethodVariant aPropertyVariant)
           
protected abstract  java.lang.String attributeGetter(IAnyType aType, IAttrRefOrDecl aRefOrDecl, MethodVariant aPropertyVariant, boolean aUseDataClass)
           
protected abstract  java.lang.String attributeIterator(IAnyType aType, IAttrRefOrDecl aRefOrDecl, MethodVariant aPropertyVariant, boolean aUseDataClass)
           
protected abstract  java.lang.String attributeRemover(IAnyType aType, IAttrRefOrDecl aRefOrDecl, MethodVariant aPropertyVariant)
           
protected abstract  java.lang.String attributeSetter(IAnyType aType, IAttrRefOrDecl aRefOrDecl, MethodVariant aPropertyVariant, boolean aUseDataClass)
           
protected abstract  java.lang.String begin(IAnyType aType)
           
 IBinding createBuiltInBinding(IComponent aComponent)
           
 IBinding createGlobalAttrDeclBinding(IComponent aComponent, java.lang.String aRootPackage, boolean aUseBuiltInClassesOnly)
           
 IBinding createGlobalAttrGroupBinding(IComponent aComponent, java.lang.String aRootPackage, boolean aUseBuiltInClassesOnly)
           
 IBinding createGlobalElemDeclBinding(IComponent aComponent, java.lang.String aRootPackage, boolean aUseBuiltInClassesOnly)
           
 IBinding createGlobalGroupDeclBinding(IComponent aComponent, java.lang.String aRootPackage, boolean aUseBuiltInClassesOnly)
           
 IBinding createInnerAttrDeclBinding(IComponent aComponent, IBinding aParentBinding, boolean aUseBuiltInClassesOnly)
           
 IBinding createInnerAttrGroupBinding(IComponent aComponent, IBinding aParentBinding, boolean aUseBuiltInClassesOnly)
           
 IBinding createInnerAttrRefBinding(IComponent aComponent, IBinding aParentBinding, boolean aUseBuiltInClassesOnly)
           
 IBinding createInnerAttrWildcardBinding(IComponent aComponent, IBinding aParentBinding, boolean aUseBuiltInClassesOnly)
           
 IBinding createInnerElemDeclBinding(IComponent aComponent, IBinding aParentBinding, boolean aUseBuiltInClassesOnly)
           
 IBinding createInnerElemRefBinding(IComponent aComponent, IBinding aParentBinding, boolean aUseBuiltInClassesOnly)
           
 IBinding createInnerElemWildcardBinding(IComponent aComponent, IBinding aParentBinding, boolean aUseBuiltInClassesOnly)
           
 IBinding createInnerGroupRefOrDeclBinding(IComponent aComponent, IBinding aParentBinding, boolean aUseBuiltInClassesOnly)
           
protected abstract  java.lang.String declaration(IAnyType aType)
           
protected abstract  java.lang.String doGetBuiltInPackage()
           
protected  void doVisitAnyTypeEnd(IAnyType aType)
           
protected  boolean doVisitAnyTypeStart(IAnyType aType)
           
protected abstract  java.lang.String elementChecker(IAnyType aType, IElemRefOrDecl aRefOrDecl, MethodVariant aPropertyVariant)
           
protected abstract  java.lang.String elementCreator(IAnyType aType, IElemRefOrDecl aRefOrDecl, MethodVariant aPropertyVariant)
           
protected abstract  java.lang.String elementCreatorWithType(IAnyType aType, IElemRefOrDecl aRefOrDecl, MethodVariant aPropertyVariant)
           
protected abstract  java.lang.String elementGetter(IAnyType aType, IElemRefOrDecl aRefOrDecl, MethodVariant aPropertyVariant, boolean aUseDataClass)
           
protected abstract  java.lang.String elementIterator(IAnyType aType, IElemRefOrDecl aRefOrDecl, MethodVariant aPropertyVariant, boolean aUseDataClass)
           
protected abstract  java.lang.String elementRemover(IAnyType aType, IElemRefOrDecl aRefOrDecl, MethodVariant aPropertyVariant)
           
 IMessage getEditHint(java.io.File aFile, IComponent aComponent)
          Gets a message that is output if a file generated by this cartridge must be edited manually.
protected  java.lang.String interfaceName(IAnyType aType)
           
 boolean isUpToDate(java.io.Reader aReader, IFileInfo aFileInfo)
          Checks if the previous code is up to date.
 boolean overwrite()
          Determines if any previous code is overwritten.
protected  java.lang.String pluralForm(java.lang.String aPropertyName)
          Get the plural form of a property name.
protected  java.lang.String propertyName(IDataRefOrDecl anAttrOrElem)
          Gets the property name of the decl.
protected abstract  java.lang.String referenceGetter(IAnyType aType, DataCartridge.RefConstraintInfo aConstraintInfo, MethodVariant aPropertyVariant)
           
protected abstract  java.lang.String referenceIterator(IAnyType aType, DataCartridge.RefConstraintInfo aConstraintInfo, MethodVariant aPropertyVariant)
           
protected  java.lang.String simpleStorageObjectTypeName(IAnyType aType)
           
protected  java.lang.String simpleTypeName(IAnyType aType, boolean aUseDataClass)
           
protected  java.lang.String ssoAccessor(java.lang.Class aClass)
           
protected abstract  boolean treatInherited()
           
protected abstract  boolean treatMethods(IAnyType aType)
          Checks if code for methods is to be created.
protected abstract  java.lang.String typeComment(IAnyType aType)
           
protected  boolean useDataClass(IDataRefOrDecl aRefOrDecl)
           
protected abstract  java.lang.String xPathMethod(IAnyType aType, IXPathMethod aMethod, MethodVariant aPropertyVariant)
           
 
Methods inherited from class org.jbind.xml.schema.compiler.BaseCartridge
addIndent, behaviourBaseClass, doVisitAttrDescEnd, doVisitAttrDescStart, doVisitAttrGroupDescEnd, doVisitAttrGroupDescStart, doVisitElemDescEnd, doVisitElemDescStart, doVisitElemGroupDescEnd, doVisitElemGroupDescStart, generate, getBehaviourClassCartridge, getBehaviourInterfaceCartridge, getDataClassCartridge, getDataInterfaceCartridge, getNamePrefix, getNameSuffix, initCartridge, interfaceOrClass, removeIndent, setNotEmpty, setOuterComponent, staticOrPublic, writeLn, writeMultiLn
 
Methods inherited from class org.jbind.xml.schema.compiler.AbstractCartridge
constant, getBinding, getCartridgeNo, getInnerName, getNameForPackage, getSubPackage, getUsableFqName, setCartridgeNo
 
Methods inherited from class org.jbind.xml.schema.cmp.ComponentVisitor
doAfterVisit, doBeforeVisit, doVisitAllDeclEnd, doVisitAllDeclStart, doVisitAllDescEnd, doVisitAllDescStart, doVisitAllRefEnd, doVisitAllRefStart, doVisitAnySimpleTypeEnd, doVisitAnySimpleTypeStart, doVisitAtomicTypeEnd, doVisitAtomicTypeStart, doVisitAttrDeclEnd, doVisitAttrDeclStart, doVisitAttrGroupDeclEnd, doVisitAttrGroupDeclStart, doVisitAttrGroupRefEnd, doVisitAttrGroupRefStart, doVisitAttrRefEnd, doVisitAttrRefOrDeclEnd, doVisitAttrRefOrDeclStart, doVisitAttrRefStart, doVisitAttrWildcardEnd, doVisitAttrWildcardStart, doVisitChoiceDeclEnd, doVisitChoiceDeclStart, doVisitChoiceDescEnd, doVisitChoiceDescStart, doVisitChoiceRefEnd, doVisitChoiceRefStart, doVisitComplexTypeEnd, doVisitComplexTypeStart, doVisitComponentEnd, doVisitComponentStart, doVisitContentDescEnd, doVisitContentDescStart, doVisitElemDeclEnd, doVisitElemDeclStart, doVisitElemRefEnd, doVisitElemRefOrDeclEnd, doVisitElemRefOrDeclStart, doVisitElemRefStart, doVisitElemWildcardEnd, doVisitElemWildcardStart, doVisitListTypeEnd, doVisitListTypeStart, doVisitNotationEnd, doVisitNotationStart, doVisitSequenceDeclEnd, doVisitSequenceDeclStart, doVisitSequenceDescEnd, doVisitSequenceDescStart, doVisitSequenceRefEnd, doVisitSequenceRefStart, doVisitUnionTypeEnd, doVisitUnionTypeStart, shallVisitSubComponents, visitAllDeclEnd, visitAllDeclStart, visitAllRefEnd, visitAllRefStart, visitAnySimpleTypeEnd, visitAnySimpleTypeStart, visitAnyTypeEnd, visitAnyTypeStart, visitAtomicTypeEnd, visitAtomicTypeStart, visitAttrDeclEnd, visitAttrDeclStart, visitAttrGroupDeclEnd, visitAttrGroupDeclStart, visitAttrGroupRefEnd, visitAttrGroupRefStart, visitAttrRefEnd, visitAttrRefStart, visitAttrWildcardEnd, visitAttrWildcardStart, visitChoiceDeclEnd, visitChoiceDeclStart, visitChoiceRefEnd, visitChoiceRefStart, visitComplexTypeEnd, visitComplexTypeStart, visitElemDeclEnd, visitElemDeclStart, visitElemRefEnd, visitElemRefStart, visitElemWildcardEnd, visitElemWildcardStart, visitListTypeEnd, visitListTypeStart, visitNotationEnd, visitNotationStart, visitSequenceDeclEnd, visitSequenceDeclStart, visitSequenceRefEnd, visitSequenceRefStart, visitUnionTypeEnd, visitUnionTypeStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jbind.xml.core.cmp.IComponentVisitor
shallVisitSubComponents, visitAllDeclEnd, visitAllDeclStart, visitAllRefEnd, visitAllRefStart, visitAnySimpleTypeEnd, visitAnySimpleTypeStart, visitAnyTypeEnd, visitAnyTypeStart, visitAtomicTypeEnd, visitAtomicTypeStart, visitAttrDeclEnd, visitAttrDeclStart, visitAttrGroupDeclEnd, visitAttrGroupDeclStart, visitAttrGroupRefEnd, visitAttrGroupRefStart, visitAttrRefEnd, visitAttrRefStart, visitAttrWildcardEnd, visitAttrWildcardStart, visitChoiceDeclEnd, visitChoiceDeclStart, visitChoiceRefEnd, visitChoiceRefStart, visitComplexTypeEnd, visitComplexTypeStart, visitElemDeclEnd, visitElemDeclStart, visitElemRefEnd, visitElemRefStart, visitElemWildcardEnd, visitElemWildcardStart, visitListTypeEnd, visitListTypeStart, visitNotationEnd, visitNotationStart, visitSequenceDeclEnd, visitSequenceDeclStart, visitSequenceRefEnd, visitSequenceRefStart, visitUnionTypeEnd, visitUnionTypeStart
 
Methods inherited from interface org.jbind.xml.schema.compiler.IBinder
createGlobalAnyTypeBinding, createInnerAnyTypeBinding
 

Constructor Detail

DataCartridge

public DataCartridge(java.lang.String aCartridgeAttributePrefix,
                     java.lang.String aNamePrefix,
                     java.lang.String aNameSuffix)
Method Detail

overwrite

public boolean overwrite()
Description copied from interface: ICartridge
Determines if any previous code is overwritten.

Returns:
Returns true iff previous code is overwritten.

isUpToDate

public boolean isUpToDate(java.io.Reader aReader,
                          IFileInfo aFileInfo)
                   throws java.io.IOException
Description copied from interface: ICartridge
Checks if the previous code is up to date.

Parameters:
aReader - (required). Reads the previous code.
aFileInfo - (required). The file info returned from the generate method.
Returns:
Returns true iff the previous code is up to date.
Throws:
java.io.IOException

getEditHint

public IMessage getEditHint(java.io.File aFile,
                            IComponent aComponent)
Description copied from interface: ICartridge
Gets a message that is output if a file generated by this cartridge must be edited manually. This method may only be called if overwrite returns false.

Parameters:
aFile - (required).
aComponent - (required).
Returns:
(required).

createGlobalAttrDeclBinding

public IBinding createGlobalAttrDeclBinding(IComponent aComponent,
                                            java.lang.String aRootPackage,
                                            boolean aUseBuiltInClassesOnly)

createGlobalGroupDeclBinding

public IBinding createGlobalGroupDeclBinding(IComponent aComponent,
                                             java.lang.String aRootPackage,
                                             boolean aUseBuiltInClassesOnly)

createGlobalElemDeclBinding

public IBinding createGlobalElemDeclBinding(IComponent aComponent,
                                            java.lang.String aRootPackage,
                                            boolean aUseBuiltInClassesOnly)

createGlobalAttrGroupBinding

public IBinding createGlobalAttrGroupBinding(IComponent aComponent,
                                             java.lang.String aRootPackage,
                                             boolean aUseBuiltInClassesOnly)

createBuiltInBinding

public IBinding createBuiltInBinding(IComponent aComponent)

createInnerAttrRefBinding

public IBinding createInnerAttrRefBinding(IComponent aComponent,
                                          IBinding aParentBinding,
                                          boolean aUseBuiltInClassesOnly)

createInnerAttrDeclBinding

public IBinding createInnerAttrDeclBinding(IComponent aComponent,
                                           IBinding aParentBinding,
                                           boolean aUseBuiltInClassesOnly)

createInnerAttrWildcardBinding

public IBinding createInnerAttrWildcardBinding(IComponent aComponent,
                                               IBinding aParentBinding,
                                               boolean aUseBuiltInClassesOnly)

createInnerGroupRefOrDeclBinding

public IBinding createInnerGroupRefOrDeclBinding(IComponent aComponent,
                                                 IBinding aParentBinding,
                                                 boolean aUseBuiltInClassesOnly)

createInnerElemRefBinding

public IBinding createInnerElemRefBinding(IComponent aComponent,
                                          IBinding aParentBinding,
                                          boolean aUseBuiltInClassesOnly)

createInnerElemDeclBinding

public IBinding createInnerElemDeclBinding(IComponent aComponent,
                                           IBinding aParentBinding,
                                           boolean aUseBuiltInClassesOnly)

createInnerElemWildcardBinding

public IBinding createInnerElemWildcardBinding(IComponent aComponent,
                                               IBinding aParentBinding,
                                               boolean aUseBuiltInClassesOnly)

createInnerAttrGroupBinding

public IBinding createInnerAttrGroupBinding(IComponent aComponent,
                                            IBinding aParentBinding,
                                            boolean aUseBuiltInClassesOnly)

doGetBuiltInPackage

protected abstract java.lang.String doGetBuiltInPackage()

doVisitAnyTypeStart

protected boolean doVisitAnyTypeStart(IAnyType aType)
                               throws XmlException
Overrides:
doVisitAnyTypeStart in class ComponentVisitor
Throws:
XmlException

doVisitAnyTypeEnd

protected void doVisitAnyTypeEnd(IAnyType aType)
Overrides:
doVisitAnyTypeEnd in class ComponentVisitor

useDataClass

protected boolean useDataClass(IDataRefOrDecl aRefOrDecl)

propertyName

protected java.lang.String propertyName(IDataRefOrDecl anAttrOrElem)
Gets the property name of the decl. The first letter of the property name is guaranteed to be an upper case letter.

Parameters:
anAttrOrElem - (required).
Returns:
(required).

typeComment

protected abstract java.lang.String typeComment(IAnyType aType)

declaration

protected abstract java.lang.String declaration(IAnyType aType)

begin

protected abstract java.lang.String begin(IAnyType aType)

elementGetter

protected abstract java.lang.String elementGetter(IAnyType aType,
                                                  IElemRefOrDecl aRefOrDecl,
                                                  MethodVariant aPropertyVariant,
                                                  boolean aUseDataClass)

elementChecker

protected abstract java.lang.String elementChecker(IAnyType aType,
                                                   IElemRefOrDecl aRefOrDecl,
                                                   MethodVariant aPropertyVariant)

elementRemover

protected abstract java.lang.String elementRemover(IAnyType aType,
                                                   IElemRefOrDecl aRefOrDecl,
                                                   MethodVariant aPropertyVariant)

elementCreator

protected abstract java.lang.String elementCreator(IAnyType aType,
                                                   IElemRefOrDecl aRefOrDecl,
                                                   MethodVariant aPropertyVariant)

elementCreatorWithType

protected abstract java.lang.String elementCreatorWithType(IAnyType aType,
                                                           IElemRefOrDecl aRefOrDecl,
                                                           MethodVariant aPropertyVariant)

elementIterator

protected abstract java.lang.String elementIterator(IAnyType aType,
                                                    IElemRefOrDecl aRefOrDecl,
                                                    MethodVariant aPropertyVariant,
                                                    boolean aUseDataClass)

attributeGetter

protected abstract java.lang.String attributeGetter(IAnyType aType,
                                                    IAttrRefOrDecl aRefOrDecl,
                                                    MethodVariant aPropertyVariant,
                                                    boolean aUseDataClass)

attributeChecker

protected abstract java.lang.String attributeChecker(IAnyType aType,
                                                     IAttrRefOrDecl aRefOrDecl,
                                                     MethodVariant aPropertyVariant)

attributeRemover

protected abstract java.lang.String attributeRemover(IAnyType aType,
                                                     IAttrRefOrDecl aRefOrDecl,
                                                     MethodVariant aPropertyVariant)

attributeSetter

protected abstract java.lang.String attributeSetter(IAnyType aType,
                                                    IAttrRefOrDecl aRefOrDecl,
                                                    MethodVariant aPropertyVariant,
                                                    boolean aUseDataClass)

attributeIterator

protected abstract java.lang.String attributeIterator(IAnyType aType,
                                                      IAttrRefOrDecl aRefOrDecl,
                                                      MethodVariant aPropertyVariant,
                                                      boolean aUseDataClass)

referenceGetter

protected abstract java.lang.String referenceGetter(IAnyType aType,
                                                    DataCartridge.RefConstraintInfo aConstraintInfo,
                                                    MethodVariant aPropertyVariant)

referenceIterator

protected abstract java.lang.String referenceIterator(IAnyType aType,
                                                      DataCartridge.RefConstraintInfo aConstraintInfo,
                                                      MethodVariant aPropertyVariant)

xPathMethod

protected abstract java.lang.String xPathMethod(IAnyType aType,
                                                IXPathMethod aMethod,
                                                MethodVariant aPropertyVariant)

treatMethods

protected abstract boolean treatMethods(IAnyType aType)
Checks if code for methods is to be created. No method code is generated for abstract data classes. Yet the abstract data class itself is to be created because it may contain inner classes that are not abstract.

Parameters:
aType - (required).
Returns:
Returns true iff code for methods is to be created.

treatInherited

protected abstract boolean treatInherited()

simpleTypeName

protected java.lang.String simpleTypeName(IAnyType aType,
                                          boolean aUseDataClass)

interfaceName

protected java.lang.String interfaceName(IAnyType aType)

ssoAccessor

protected java.lang.String ssoAccessor(java.lang.Class aClass)

simpleStorageObjectTypeName

protected java.lang.String simpleStorageObjectTypeName(IAnyType aType)

pluralForm

protected java.lang.String pluralForm(java.lang.String aPropertyName)
Get the plural form of a property name. The plural form is constructed by the following rules: if the property name ends with a "y" and the second last character is not a vowel then the "y" is replaced by "ies", if the property name ends with a "s" then "es" is appended, otherwise a "s" is appended.

Parameters:
aPropertyName - (required).
Returns:
(required).