org.exolab.castor.builder
Class SourceFactory

java.lang.Object
  extended byorg.exolab.castor.builder.SourceFactory

public class SourceFactory
extends java.lang.Object

This class creates the Java Source classes for Schema components

Version:
$Revision: 1.12 $ $Date: 2004/02/14 07:31:48 $
Author:
Keith Visco, Arnaud Blandin

Constructor Summary
SourceFactory(BuilderConfiguration config)
          Creates a new SourceFactory using the default FieldInfo factory.
SourceFactory(BuilderConfiguration config, FieldInfoFactory infoFactory)
          Creates a new SourceFactory with the given FieldInfoFactory
 
Method Summary
static void createEqualsMethod(org.exolab.javasource.JClass jclass)
          Create an 'equals' method on the given JClass
 org.exolab.javasource.JClass createSourceCode(org.exolab.castor.xml.schema.SimpleType simpleType, org.exolab.castor.builder.SGStateInfo sgState)
          Creates the Java source code to support the given Simpletype
 org.exolab.javasource.JClass[] createSourceCode(org.exolab.castor.builder.binding.XMLBindingComponent component, org.exolab.castor.builder.SGStateInfo sgState)
          Creates a new ClassInfo for the given XMLBindingComponent.
static void createTestableMethods(org.exolab.javasource.JClass jclass)
          Implement org.exolab.castor.tests.framework.CastorTestable im the given JClass
 void setCreateExtraMethods(boolean extraMethods)
          Sets whether or not to create extra collection methods for accessing the actual collection
 void setCreateMarshalMethods(boolean createMarshalMethods)
          Sets whether or not to create the XML marshalling framework specific methods (marshall, unmarshall, validate) in the generated classes.
 void setReferenceMethodSuffix(java.lang.String suffix)
          Sets the method suffix (ending) to use when creating the extra collection methods.
 void setSAX1(boolean sax1)
          Sets to true if SAX1 should be used in the marshall method.
 void setTestable(boolean testable)
          Sets whether or not to create the XML marshalling framework specific methods (marshall, unmarshall, validate) in the generated classes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceFactory

public SourceFactory(BuilderConfiguration config)
Creates a new SourceFactory using the default FieldInfo factory.

Parameters:
config - the BuilderConfiguration instance (must not be null).

SourceFactory

public SourceFactory(BuilderConfiguration config,
                     FieldInfoFactory infoFactory)
Creates a new SourceFactory with the given FieldInfoFactory

Parameters:
config - the BuilderConfiguration instance (must not be null).
infoFactory - the FieldInfoFactory to use
Method Detail

setCreateMarshalMethods

public void setCreateMarshalMethods(boolean createMarshalMethods)
Sets whether or not to create the XML marshalling framework specific methods (marshall, unmarshall, validate) in the generated classes. By default, these methods are generated.

Parameters:
createMarshalMethods - a boolean, when true indicates to generated the marshalling framework methods

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 in CollectionInfo will be used.
See Also:
setCreateExtraMethods

setTestable

public void setTestable(boolean testable)
Sets whether or not to create the XML marshalling framework specific methods (marshall, unmarshall, validate) in the generated classes. By default, these methods are generated.

Parameters:
testable - a boolean, when true indicates to generate testing framework methods

setSAX1

public void setSAX1(boolean sax1)
Sets to true if SAX1 should be used in the marshall method.

Parameters:
sax1 - true if SAX1 should be used.

createSourceCode

public org.exolab.javasource.JClass[] createSourceCode(org.exolab.castor.builder.binding.XMLBindingComponent component,
                                                       org.exolab.castor.builder.SGStateInfo sgState)
Creates a new ClassInfo for the given XMLBindingComponent.

Parameters:
component - the XMLBindingComponent that abstracts all XML Schema definition for a XML Schema component.
sgState - The given state of the SourceGenerator.
Returns:
an array of JClasses reflecting the given XMLBindingComponent.

createSourceCode

public org.exolab.javasource.JClass createSourceCode(org.exolab.castor.xml.schema.SimpleType simpleType,
                                                     org.exolab.castor.builder.SGStateInfo sgState)
Creates the Java source code to support the given Simpletype

Parameters:
simpleType - the Simpletype to create the Java source for
sgState - the current SGStateInfo (cannot be null).
Returns:
the JClass representation of the given Simpletype

createEqualsMethod

public static void createEqualsMethod(org.exolab.javasource.JClass jclass)
Create an 'equals' method on the given JClass

Parameters:
jclass - the Jclass in which we create the equals method

createTestableMethods

public static void createTestableMethods(org.exolab.javasource.JClass jclass)
Implement org.exolab.castor.tests.framework.CastorTestable im the given JClass

Parameters:
jclass - the JCLass which will implement the CastorTestable Interface
See Also:
org.exolab.castor.tests.framework.CastorTestable


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