org.exolab.castor.builder
Class BuilderConfiguration

java.lang.Object
  extended byorg.exolab.castor.builder.BuilderConfiguration
Direct Known Subclasses:
SourceGenerator

public class BuilderConfiguration
extends java.lang.Object

The configuration for the SourceGenerator

Version:
$Revision: 1.2 $ $Date: 2003/09/12 09:13:00 $
Author:
Keith Visco, Arnaud Blandin

Nested Class Summary
static class BuilderConfiguration.Property
          Names of properties used in the configuration file.
 
Constructor Summary
BuilderConfiguration()
          Creates a default BuilderConfiguration
 
Method Summary
 boolean boundPropertiesEnabled()
          Returns true if bound properties are enabled.
 boolean classDescFieldNames()
          Returns true if we generate a 'public static final String' for the name of each attribute and element described by the class descriptor Enabling this property is controlled via the org.exolab.castor.builder.classdescfieldnames item in the castorbuilder.properties file.
 boolean equalsMethod()
          Returns true if we generate an 'equals' method for each generated class.
 boolean generateExtraCollectionMethods()
          Returns true if extra methods for collection fields should be generated.
 java.util.Properties getDefault()
          Returns the default configuration file.
 java.lang.String getProperty(java.lang.String name, java.lang.String defValue)
          Returns a property from the default configuration file.
 java.lang.String lookupPackageByLocation(java.lang.String schemaLocation)
          Gets a Java package to a schema location.
 java.lang.String lookupPackageByNamespace(java.lang.String nsURL)
          Gets a Java package to an XML namespace URL
 boolean mappingSchemaElement2Java()
          Tests the org.exolab.castor.builder.javaclassmapping property for the 'element' value.
 boolean mappingSchemaType2Java()
          Tests the org.exolab.castor.builder.javaclassmapping property for the 'type' value.
 void setClassDescFieldNames(boolean classDescFieldNames)
          Sets the 'classDescFieldNames' property
 void setDefaultProperties(java.util.Properties properties)
          Overrides the current set of properties with the given properties.
 void setEqualsMethod(boolean equals)
          Sets the 'equalsmethod' property
 void setLocationPackageMapping(java.lang.String schemaLocation, java.lang.String packageName)
          Sets the schemaLocation to package mapping
 void setNamespacePackageMapping(java.lang.String ns, java.lang.String packageName)
          Sets the namespace to package mapping
 void setPrimitiveWrapper(boolean wrapper)
          Sets the 'primitivetowrapper' property
 boolean usePrimitiveWrapper()
          Returns true if primitive types have to be used as Objects (eg.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuilderConfiguration

public BuilderConfiguration()
Creates a default BuilderConfiguration

Method Detail

getDefault

public java.util.Properties getDefault()
Returns the default configuration file. Changes to the returned properties set will affect all Castor functions relying on the default configuration.

Returns:
The default configuration

getProperty

public java.lang.String getProperty(java.lang.String name,
                                    java.lang.String defValue)
Returns a property from the default configuration file. Equivalent to calling getProperty on the result of getDefault().

Parameters:
name - The property name
Returns:
The property's value

boundPropertiesEnabled

public boolean boundPropertiesEnabled()
Returns true if bound properties are enabled. Enabling bound properties is controlled via the org.exolab.castor.builder.boundproperties item in the castorbuilder.properties file. The value is either 'true' or 'false'.

Returns:
true if bound properties are enabled.

equalsMethod

public boolean equalsMethod()
Returns true if we generate an 'equals' method for each generated class. Enabling this property is controlled via the org.exolab.castor.builder.equalsmethod item in the castorbuilder.properties file. The value is either 'true' or 'false'.

Returns:
true if bound properties are enabled.

setEqualsMethod

public void setEqualsMethod(boolean equals)
Sets the 'equalsmethod' property


classDescFieldNames

public boolean classDescFieldNames()
Returns true if we generate a 'public static final String' for the name of each attribute and element described by the class descriptor Enabling this property is controlled via the org.exolab.castor.builder.classdescfieldnames item in the castorbuilder.properties file. The value is either 'true' or 'false'.

Returns:
true if bound properties are enabled.

generateExtraCollectionMethods

public boolean generateExtraCollectionMethods()
Returns true if extra methods for collection fields should be generated. Such methods include set/get methods for the actual collection in addition to the array methods. Enabling extra collection methods is controlled via the org.exolab.castor.builder.extraCollectionMethods property in the castorbuilder.properties file. The value is either 'true' or 'false'.

Returns:
true if extra collection methods are enabled.

setClassDescFieldNames

public void setClassDescFieldNames(boolean classDescFieldNames)
Sets the 'classDescFieldNames' property


usePrimitiveWrapper

public boolean usePrimitiveWrapper()
Returns true if primitive types have to be used as Objects (eg. replacing float by java.lang.Float).


setPrimitiveWrapper

public void setPrimitiveWrapper(boolean wrapper)
Sets the 'primitivetowrapper' property


mappingSchemaElement2Java

public boolean mappingSchemaElement2Java()
Tests the org.exolab.castor.builder.javaclassmapping property for the 'element' value.

Returns:
True if the Source Generator is mapping schema elements to Java classes.

mappingSchemaType2Java

public boolean mappingSchemaType2Java()
Tests the org.exolab.castor.builder.javaclassmapping property for the 'type' value.

Returns:
True if the Source Generator is mapping schema types to Java classes.

setDefaultProperties

public void setDefaultProperties(java.util.Properties properties)
Overrides the current set of properties with the given properties. Once the properties are set, only a copy will be uses, so any changes to the given properties file after the fact will go unnoticed.

Parameters:
properties - the Properties file

setNamespacePackageMapping

public void setNamespacePackageMapping(java.lang.String ns,
                                       java.lang.String packageName)
Sets the namespace to package mapping

Parameters:
ns - the namespace URI to map
packageName - the package name

setLocationPackageMapping

public void setLocationPackageMapping(java.lang.String schemaLocation,
                                      java.lang.String packageName)
Sets the schemaLocation to package mapping

Parameters:
schemaLocation - the schemaLocation to map
packageName - the package name to map to

lookupPackageByNamespace

public java.lang.String lookupPackageByNamespace(java.lang.String nsURL)
Gets a Java package to an XML namespace URL


lookupPackageByLocation

public java.lang.String lookupPackageByLocation(java.lang.String schemaLocation)
Gets a Java package to a schema location.



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