com.sun.tools.xjc.reader.xmlschema
Class ConversionFinder

java.lang.Object
  extended by com.sun.tools.xjc.reader.xmlschema.BindingComponent
      extended by com.sun.tools.xjc.reader.xmlschema.ConversionFinder

public final class ConversionFinder
extends BindingComponent

Finds TypeUse object that is attached to the nearest ancestor datatype. A transducer specified in a type is inherited by types derived from that type, unless overwritten.

JAXB spec defines the default transducers that will be applied, and users can also change them by applying customizations. This method takes care of those details.

Note that since one transducer can apply to many datatypes with different whitespace normalization requirement, it is the caller's responsiblility to perform the correct whitespace normalization to the transducer returned from this method.

If none is found, which can only happen to unions and lists, null will be returned.

Since type-safe enums are handled as conversions, this class also builds type-safe enum classes if necesasry.


Field Summary
static java.util.Map<java.lang.String,TypeUse> builtinConversions
          Transducers for the built-in types.
 
Constructor Summary
ConversionFinder()
           
 
Method Summary
static boolean canBeMappedToTypeSafeEnum(com.sun.xml.xsom.XSSimpleType type)
          Returns true if the given simple type can be mapped to a type-safe enum class.
 TypeUse find(com.sun.xml.xsom.XSSimpleType type, com.sun.xml.xsom.XSComponent referer)
          Public entry point.
 
Methods inherited from class com.sun.tools.xjc.reader.xmlschema.BindingComponent
getClassSelector, getErrorReporter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

builtinConversions

public static final java.util.Map<java.lang.String,TypeUse> builtinConversions
Transducers for the built-in types. Read-only.

Constructor Detail

ConversionFinder

ConversionFinder()
Method Detail

find

public TypeUse find(com.sun.xml.xsom.XSSimpleType type,
                    com.sun.xml.xsom.XSComponent referer)
Public entry point.


canBeMappedToTypeSafeEnum

public static boolean canBeMappedToTypeSafeEnum(com.sun.xml.xsom.XSSimpleType type)
Returns true if the given simple type can be mapped to a type-safe enum class.

JAXB spec places a restrictrion as to what type can be mapped to a type-safe enum. This method enforces this constraint.