org.exolab.castor.builder
Class CollectionInfo

java.lang.Object
  extended byorg.exolab.castor.builder.XMLInfo
      extended byorg.exolab.castor.builder.FieldInfo
          extended byorg.exolab.castor.builder.CollectionInfo
Direct Known Subclasses:
CollectionInfoJ2, CollectionInfoODMG30

public class CollectionInfo
extends FieldInfo

A helper used for generating source that deals with Collections

Version:
$Revision: 1.1.1.1 $ $Date: 2003/03/03 07:07:41 $
Author:
Keith Visco

Field Summary
static java.lang.String REFERENCE_SUFFIX_PROPERTY
          The property used to overwrite the reference suffix for extra collection methods
protected  XSList xsList
           
 
Fields inherited from class org.exolab.castor.builder.XMLInfo
ATTRIBUTE_TYPE, ELEMENT_TYPE, TEXT_TYPE
 
Constructor Summary
CollectionInfo(XSType contentType, java.lang.String name, java.lang.String elementName)
          Creates a new CollectionInfo
 
Method Summary
 void createAccessMethods(JClass jClass)
          Creates the Access methods for the collection described by this CollectionInfo
 void createAddInsertMethod(JMethod method)
          Creates implementation of add method with an index.
 void createAddMethod(JMethod method)
          Creates implementation of add method.
protected  void createBoundPropertyCode(JSourceCode jsc)
          Creates the necessary source code for notifying PropertyChangeListeners when the collection has been updated.
 void createEnumerateMethod(JMethod method)
          Creates implementation of Enumerate method.
 void createGetByIndexMethod(JMethod method)
          Creates implementation of the get(index) method.
 void createGetCollectionReferenceMethod(JMethod method)
          Creates implementation of collection reference get method.
 void createGetCountMethod(JMethod method)
          Creates implementation of getCount method.
 void createGetMethod(JMethod method)
          Creates implementation of object[] get() method.
 void createRemoveAllMethod(JMethod method)
          Creates implementation of removeAll() method.
 void createRemoveByIndexMethod(JMethod method)
          Creates implementation of remove(int i) method.
 void createRemoveByObjectMethod(JMethod method)
          Creates implementation of remove(Object) method.
 void createSetArrayMethod(JMethod method)
          Creates implementation of array set method
 void createSetByIndexMethod(JMethod method)
          Creates implementation of set method.
 void createSetCollectionMethod(JMethod method)
          Creates implementation of collection set method.
 void createSetCollectionReferenceMethod(JMethod method)
          Creates implementation of collection reference set method.
protected  boolean extraMethods()
          Returns true if extra collection methods should be generated
 void generateInitializerCode(JSourceCode jsc)
          Creates code for initialization of this Member
 FieldInfo getContent()
           
 java.lang.String getContentName()
           
 XSType getContentType()
           
 java.lang.String getElementName()
           
 JMethod getReadMethod()
          Returns the main read method for this member
 java.lang.String getReadMethodName()
          Returns the name of the read method for this FieldInfo
 java.lang.String getWriteMethodName()
          Returns the name of the write method for this FieldInfo
 XSList getXSList()
           
 boolean isMultivalued()
          Return whether or not this member is a multivalued member or not
 
Methods inherited from class org.exolab.castor.builder.FieldInfo
createGetterComment, createJavaField, createSetterComment, getComment, getDeclaringClassInfo, getDefaultValue, getDeleteMethodName, getFixedValue, getHasMethodName, getName, getValidator, getXMLFieldHandler, isBound, isContainer, isTransient, methodSuffix, setBound, setComment, setContainer, setDeclaringClassInfo, setDefaultValue, setFinal, setFixedValue, setStatic, setTransient, setValidator, setXMLFieldHandler
 
Methods inherited from class org.exolab.castor.builder.XMLInfo
getNamespacePrefix, getNamespaceURI, getNodeName, getNodeType, getNodeTypeName, getSchemaType, isRequired, setMultivalued, setNamespacePrefix, setNamespaceURI, setNodeName, setNodeType, setRequired, setSchemaType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REFERENCE_SUFFIX_PROPERTY

public static final java.lang.String REFERENCE_SUFFIX_PROPERTY
The property used to overwrite the reference suffix for extra collection methods

See Also:
Constant Field Values

xsList

protected XSList xsList
Constructor Detail

CollectionInfo

public CollectionInfo(XSType contentType,
                      java.lang.String name,
                      java.lang.String elementName)
Creates a new CollectionInfo

Parameters:
name - the name of the Collection
elementName - the element name for each element in collection
Method Detail

generateInitializerCode

public void generateInitializerCode(JSourceCode jsc)
Creates code for initialization of this Member

Overrides:
generateInitializerCode in class FieldInfo
Parameters:
jsc - the JSourceCode in which to add the source to

getReadMethodName

public java.lang.String getReadMethodName()
Description copied from class: FieldInfo
Returns the name of the read method for this FieldInfo

Overrides:
getReadMethodName in class FieldInfo
Returns:
the name of the read method for this FieldInfo

getWriteMethodName

public java.lang.String getWriteMethodName()
Description copied from class: FieldInfo
Returns the name of the write method for this FieldInfo

Overrides:
getWriteMethodName in class FieldInfo
Returns:
the name of the write method for this FieldInfo

createAccessMethods

public void createAccessMethods(JClass jClass)
Creates the Access methods for the collection described by this CollectionInfo

Overrides:
createAccessMethods in class FieldInfo
Parameters:
jClass - the JClass to add the methods to.

getReadMethod

public JMethod getReadMethod()
Returns the main read method for this member

Returns:
the main read method for this member

getXSList

public XSList getXSList()

getContentName

public java.lang.String getContentName()

getContentType

public XSType getContentType()

getContent

public FieldInfo getContent()

getElementName

public java.lang.String getElementName()

isMultivalued

public boolean isMultivalued()
Return whether or not this member is a multivalued member or not

Overrides:
isMultivalued in class XMLInfo
Returns:
true if this member can appear more than once

createAddMethod

public void createAddMethod(JMethod method)
Creates implementation of add method.

Parameters:
method - the JMethod in which to create the source code.

createAddInsertMethod

public void createAddInsertMethod(JMethod method)
Creates implementation of add method with an index.

Parameters:
method - the JMethod in which to create the source code.

createGetMethod

public void createGetMethod(JMethod method)
Creates implementation of object[] get() method.

Parameters:
method - the JMethod in which to create the source code.

createGetCollectionReferenceMethod

public void createGetCollectionReferenceMethod(JMethod method)
Creates implementation of collection reference get method. This method simply returns the actual reference to the collection.

Parameters:
method - the JMethod in which to create the source code.

createGetByIndexMethod

public void createGetByIndexMethod(JMethod method)
Creates implementation of the get(index) method.


createSetArrayMethod

public void createSetArrayMethod(JMethod method)
Creates implementation of array set method

Parameters:
method - the JMethod in which to create the source code.

createSetByIndexMethod

public void createSetByIndexMethod(JMethod method)
Creates implementation of set method.

Parameters:
method - the JMethod in which to create the source code.

createSetCollectionMethod

public void createSetCollectionMethod(JMethod method)
Creates implementation of collection set method. The method will assign the field a copy of the given collection. The fields will be checked for type safety.

Parameters:
method - the JMethod in which to create the source code.

createSetCollectionReferenceMethod

public void createSetCollectionReferenceMethod(JMethod method)
Creates implementation of collection reference set method. This method is a non-type safe method which simply assigns the given collection to the field.

Parameters:
method - the JMethod in which to create the source code.

createBoundPropertyCode

protected void createBoundPropertyCode(JSourceCode jsc)
Creates the necessary source code for notifying PropertyChangeListeners when the collection has been updated.

Parameters:
jsc - the JSourceCode to add the new source code to.

createGetCountMethod

public void createGetCountMethod(JMethod method)
Creates implementation of getCount method.

Parameters:
method - the JMethod in which to create the source code.

createEnumerateMethod

public void createEnumerateMethod(JMethod method)
Creates implementation of Enumerate method.

Parameters:
method - the JMethod in which to create the source code.

createRemoveByObjectMethod

public void createRemoveByObjectMethod(JMethod method)
Creates implementation of remove(Object) method.

Parameters:
method - the JMethod in which to create the source code.

createRemoveByIndexMethod

public void createRemoveByIndexMethod(JMethod method)
Creates implementation of remove(int i) method.

Parameters:
method - the JMethod in which to create the source code.

createRemoveAllMethod

public void createRemoveAllMethod(JMethod method)
Creates implementation of removeAll() method.

Parameters:
method - the JMethod in which to create the source code.

extraMethods

protected final boolean extraMethods()
Returns true if extra collection methods should be generated

Returns:
true if extra collection methods should be generated


Intalio Inc. (C) 1999-2003. All rights reserved http://www.intalio.com