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

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

public final class SimpleTypeBuilder
extends BindingComponent

Builds TypeUse from simple types.

This code consists of two main portions. The compose(XSSimpleType) method and composer forms an outer cycle, which gradually ascends the type inheritance chain until it finds the suitable binding. When it does this initiatingType is set to the type which started binding, so that we can refer to the actual constraint facets and such that are applicable on the type.

For each intermediate type in the chain, the find(XSSimpleType) method is used to find the binding on that type, sine the outer loop is doing the ascending, this method only sees if the current type has some binding available.

There is at least one ugly code that you need to aware of when you are modifying the code. See the documentation about "simple type customization at the point of reference."


Field Summary
protected  BGMBuilder builder
           
static Map<String,TypeUse> builtinConversions
          TypeUses for the built-in types.
 XSSimpleTypeFunction<TypeUse> composer
           
 Stack<XSComponent> refererStack
          The component that is refering to the simple type which we are building.
 
Constructor Summary
SimpleTypeBuilder()
           
 
Method Summary
 TypeUse build(XSSimpleType type)
          Entry point from outside.
 TypeUse buildDef(XSSimpleType type)
          A version of the build(XSSimpleType) method used to bind the definition of a class generated from the given simple type.
static boolean canBeMappedToTypeSafeEnum(XSSimpleType type)
          Returns true if the given simple type can be mapped to a type-safe enum class.
(package private)  TypeUse compose(XSSimpleType t)
          Recursively decend the type inheritance chain to find a binding.
 XSComponent getReferer()
           
 boolean isAcknowledgedXmimeContentTypes(XSComponent c)
           
 
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

builder

protected final BGMBuilder builder

refererStack

public final Stack<XSComponent> refererStack
The component that is refering to the simple type which we are building. This is ugly but necessary to support the customization of simple types at its point of reference. See my comment at the header of this class for details. UGLY: Implemented as a Stack of XSComponent to fix a bug


builtinConversions

public static final Map<String,TypeUse> builtinConversions
TypeUses for the built-in types. Read-only.


composer

public final XSSimpleTypeFunction<TypeUse> composer
Constructor Detail

SimpleTypeBuilder

public SimpleTypeBuilder()
Method Detail

build

public TypeUse build(XSSimpleType type)
Entry point from outside. Builds a BGM type expression from a simple type schema component.

Parameters:
type - the simple type to be bound.

buildDef

public TypeUse buildDef(XSSimpleType type)
A version of the build(XSSimpleType) method used to bind the definition of a class generated from the given simple type.


getReferer

public XSComponent getReferer()

compose

TypeUse compose(XSSimpleType t)
Recursively decend the type inheritance chain to find a binding.


canBeMappedToTypeSafeEnum

public static boolean canBeMappedToTypeSafeEnum(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.


isAcknowledgedXmimeContentTypes

public boolean isAcknowledgedXmimeContentTypes(XSComponent c)