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.2 $ $Date: 2003/09/12 08:29:46 $
Author:
Keith Visco

Field Summary
static java.lang.String DEFAULT_REFERENCE_SUFFIX
           
static java.lang.String REFERENCE_SUFFIX_PROPERTY
          The property used to overwrite the reference suffix for extra collection methods
 
Fields inherited from class org.exolab.castor.builder.XMLInfo
ATTRIBUTE_TYPE, ELEMENT_TYPE, TEXT_TYPE
 
Constructor Summary
CollectionInfo(org.exolab.castor.builder.types.XSType contentType, java.lang.String name, java.lang.String elementName)
          Creates a new CollectionInfo
 
Method Summary
 void createAccessMethods(org.exolab.javasource.JClass jClass)
          Creates the Access methods for the collection described by this CollectionInfo
 void createAddInsertMethod(org.exolab.javasource.JMethod method)
          Creates implementation of add method with an index.
 void createAddMethod(org.exolab.javasource.JMethod method)
          Creates implementation of add method.
 void createEnumerateMethod(org.exolab.javasource.JMethod method)
          Creates implementation of Enumerate method.
 void createGetByIndexMethod(org.exolab.javasource.JMethod method)
          Creates implementation of the get(index) method.
 void createGetCollectionReferenceMethod(org.exolab.javasource.JMethod method)
          Creates implementation of collection reference get method.
 void createGetCountMethod(org.exolab.javasource.JMethod method)
          Creates implementation of getCount method.
 void createGetMethod(org.exolab.javasource.JMethod method)
          Creates implementation of object[] get() method.
 void createRemoveAllMethod(org.exolab.javasource.JMethod method)
          Creates implementation of removeAll() method.
 void createRemoveByIndexMethod(org.exolab.javasource.JMethod method)
          Creates implementation of remove(int i) method.
 void createRemoveByObjectMethod(org.exolab.javasource.JMethod method)
          Creates implementation of remove(Object) method.
 void createSetArrayMethod(org.exolab.javasource.JMethod method)
          Creates implementation of array set method
 void createSetByIndexMethod(org.exolab.javasource.JMethod method)
          Creates implementation of set method.
 void createSetCollectionMethod(org.exolab.javasource.JMethod method)
          Creates implementation of collection set method.
 void createSetCollectionReferenceMethod(org.exolab.javasource.JMethod method)
          Creates implementation of collection reference set method.
 void generateInitializerCode(org.exolab.javasource.JSourceCode jsc)
          Creates code for initialization of this Member
 FieldInfo getContent()
           
 java.lang.String getContentName()
           
 org.exolab.castor.builder.types.XSType getContentType()
           
 java.lang.String getElementName()
           
 org.exolab.javasource.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
 org.exolab.castor.builder.types.XSList getXSList()
           
 boolean isMultivalued()
          Return whether or not this member is a multivalued member or not
 void setCreateExtraMethods(boolean extraMethods)
          Sets whether or not to create extra collection methods for accessing the actual collection
 void setReferenceMethodSuffix(java.lang.String suffix)
          Sets the method suffix (ending) to use when creating the extra collection methods.
 
Methods inherited from class org.exolab.castor.builder.FieldInfo
createGetterComment, createJavaField, createSetterComment, getComment, getDeclaringClassInfo, getDefaultValue, getDeleteMethodName, getFixedValue, getHasMethodName, getName, getValidator, getXMLFieldHandler, isBound, isContainer, isTransient, 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
equals, 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

DEFAULT_REFERENCE_SUFFIX

public static final java.lang.String DEFAULT_REFERENCE_SUFFIX
See Also:
Constant Field Values
Constructor Detail

CollectionInfo

public CollectionInfo(org.exolab.castor.builder.types.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(org.exolab.javasource.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(org.exolab.javasource.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 org.exolab.javasource.JMethod getReadMethod()
Returns the main read method for this member

Returns:
the main read method for this member

getXSList

public org.exolab.castor.builder.types.XSList getXSList()

getContentName

public java.lang.String getContentName()

getContentType

public org.exolab.castor.builder.types.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(org.exolab.javasource.JMethod method)
Creates implementation of add method.

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

createAddInsertMethod

public void createAddInsertMethod(org.exolab.javasource.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(org.exolab.javasource.JMethod method)
Creates implementation of object[] get() method.

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

createGetCollectionReferenceMethod

public void createGetCollectionReferenceMethod(org.exolab.javasource.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(org.exolab.javasource.JMethod method)
Creates implementation of the get(index) method.


createSetArrayMethod

public void createSetArrayMethod(org.exolab.javasource.JMethod method)
Creates implementation of array set method

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

createSetByIndexMethod

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

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

createSetCollectionMethod

public void createSetCollectionMethod(org.exolab.javasource.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(org.exolab.javasource.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.

setCreateExtraMethods

public void setCreateExtraMethods(boolean extraMethods)
Sets whether or not to create extra collection methods for accessing the actual collection

Parameters:
extraMethods - a boolean that when true indicates that extra collection accessor methods should be created. False by default.
See Also:
setReferenceMethodSuffix

setReferenceMethodSuffix

public void setReferenceMethodSuffix(java.lang.String suffix)
Sets the method suffix (ending) to use when creating the extra collection methods.

Parameters:
suffix - the method suffix to use when creating the extra collection methods. If null or emtpty the default value, as specified by DEFAULT_REFERENCE_SUFFIX will used.
See Also:
setCreateExtraMethods

createGetCountMethod

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

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

createEnumerateMethod

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

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

createRemoveByObjectMethod

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

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

createRemoveByIndexMethod

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

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

createRemoveAllMethod

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

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


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