org.exolab.castor.builder.factory

Class EnumerationFactory


public final class EnumerationFactory
extends BaseFactory

This class creates the Java sources for XML Schema components that define an enumeration.
Version:
$Revision: 6287 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
Author:
Werner Guttmann

Constructor Summary

EnumerationFactory(BuilderConfiguration config, GroupNaming groupNaming, SourceGenerator sourceGenerator)
Creates a new EnumerationFactory for the builder configuration given.

Method Summary

(package private) void
processEnumerationAsBaseType(ExtendedBinding binding, SimpleType simpleType, FactoryState state)
Creates all the necessary enumeration code from the given SimpleType.
(package private) void
processEnumerationAsNewObject(ExtendedBinding binding, SimpleType simpleType, FactoryState state)
Creates all the necessary enumeration code for a given SimpleType.
void
setCaseInsensitive(boolean caseInsensitive)
Set to true if enumerated type lookups should be performed in a case insensitive manner.

Methods inherited from class org.exolab.castor.builder.factory.BaseFactory

createComment, extractCommentsFromAnnotations, getConfig, getGroupNaming, getInfoFactory, getJavaNaming, getSourceGenerator, normalize, setGroupNaming

Constructor Details

EnumerationFactory

public EnumerationFactory(BuilderConfiguration config,
                          GroupNaming groupNaming,
                          SourceGenerator sourceGenerator)
Creates a new EnumerationFactory for the builder configuration given.
Parameters:
config - the current BuilderConfiguration instance.
groupNaming - The group naming scheme to be used.
sourceGenerator - the calling source generator.

Method Details

processEnumerationAsBaseType

(package private)  void processEnumerationAsBaseType(ExtendedBinding binding,
                                                     SimpleType simpleType,
                                                     FactoryState state)
Creates all the necessary enumeration code from the given SimpleType. Enumerations are handled by creating an Object like the following:
     public class {name} {
         // list of values
         {type}[] values = {
             ...
         };

         // Returns true if the given value is part
         // of this enumeration
         public boolean contains({type} value);

         // Returns the {type} value whose String value
         // is equal to the given String
         public {type} valueOf(String strValue);
     }
 
Parameters:
binding - Extended binding instance
simpleType - the SimpleType we are processing an enumeration for
state - our current state

processEnumerationAsNewObject

(package private)  void processEnumerationAsNewObject(ExtendedBinding binding,
                                                      SimpleType simpleType,
                                                      FactoryState state)
Creates all the necessary enumeration code for a given SimpleType.
Parameters:
binding - Extended binding instance
simpleType - the SimpleType we are processing an enumeration for
state - our current state

setCaseInsensitive

public void setCaseInsensitive(boolean caseInsensitive)
Set to true if enumerated type lookups should be performed in a case insensitive manner.
Parameters:
caseInsensitive - when true

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