org.exolab.castor.builder

Class CollectionInfo

Known Direct 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 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, String name, 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()
String
getContentName()
XSType
getContentType()
String
getElementName()
JMethod
getReadMethod()
Returns the main read method for this member
String
getReadMethodName()
Returns the name of the read method for this FieldInfo
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

createAccessMethods, createGetterComment, createJavaField, createSetterComment, generateInitializerCode, getComment, getDeclaringClassInfo, getDefaultValue, getDeleteMethodName, getFixedValue, getHasMethodName, getName, getReadMethodName, getValidator, getWriteMethodName, 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, isMultivalued, isRequired, setMultivalued, setNamespacePrefix, setNamespaceURI, setNodeName, setNodeType, setRequired, setSchemaType

Field Details

REFERENCE_SUFFIX_PROPERTY

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

xsList

protected XSList xsList

Constructor Details

CollectionInfo

public CollectionInfo(XSType contentType,
                      String name,
                      String elementName)
Creates a new CollectionInfo
Parameters:
name - the name of the Collection
elementName - the element name for each element in collection

Method Details

createAccessMethods

public void createAccessMethods(JClass jClass)
Creates the Access methods for the collection described by this CollectionInfo
Overrides:
createAccessMethods in interface FieldInfo
Parameters:
jClass - the JClass to add the methods to.

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.

createAddMethod

public void createAddMethod(JMethod method)
Creates implementation of add method.
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.

createEnumerateMethod

public void createEnumerateMethod(JMethod method)
Creates implementation of Enumerate method.
Parameters:
method - the JMethod in which to create the source code.

createGetByIndexMethod

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

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.

createGetCountMethod

public void createGetCountMethod(JMethod method)
Creates implementation of getCount method.
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.

createRemoveAllMethod

public void createRemoveAllMethod(JMethod method)
Creates implementation of removeAll() 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.

createRemoveByObjectMethod

public void createRemoveByObjectMethod(JMethod method)
Creates implementation of remove(Object) method.
Parameters:
method - the JMethod in which to create the source code.

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.

extraMethods

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

generateInitializerCode

public void generateInitializerCode(JSourceCode jsc)
Creates code for initialization of this Member
Overrides:
generateInitializerCode in interface FieldInfo
Parameters:
jsc - the JSourceCode in which to add the source to

getContent

public FieldInfo getContent()

getContentName

public String getContentName()

getContentType

public XSType getContentType()

getElementName

public String getElementName()

getReadMethod

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

getReadMethodName

public String getReadMethodName()
Returns the name of the read method for this FieldInfo
Overrides:
getReadMethodName in interface FieldInfo
Returns:
the name of the read method for this FieldInfo

getWriteMethodName

public String getWriteMethodName()
Returns the name of the write method for this FieldInfo
Overrides:
getWriteMethodName in interface FieldInfo
Returns:
the name of the write method for this FieldInfo

getXSList

public XSList getXSList()

isMultivalued

public boolean isMultivalued()
Return whether or not this member is a multivalued member or not
Overrides:
isMultivalued in interface XMLInfo
Returns:
true if this member can appear more than once

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