Top Description Fields Constructors Methods
com.sun.tools.xjc.reader.xmlschema.ct

pack-priv abstract Class AbstractExtendedComplexTypeBuilder

extends CTBuilder
Class Inheritance
Known Direct Subclasses
com.sun.tools.xjc.reader.xmlschema.ct.ExtendedComplexTypeBuilder, com.sun.tools.xjc.reader.xmlschema.ct.MixedExtendedComplexTypeBuilder
Imports
java.util.HashMap, .Iterator, .Map, com.sun.tools.xjc.reader.xmlschema.WildcardNameClassBuilder, com.sun.xml.xsom.XSAttributeUse, .XSComplexType, .XSContentType, .XSDeclaration, .XSElementDecl, .XSModelGroup, .XSModelGroupDecl, .XSParticle, .XSType, .XSWildcard, com.sun.xml.xsom.visitor.XSTermFunction, javax.xml.namespace.QName, com.sun.tools.rngom.nc.ChoiceNameClass, .NameClass, .SimpleNameClass

Binds a complex type derived from another complex type by extension.
Author
Kohsuke Kawaguchi ([email protected])

Field Summary

Modifier and TypeField and Description
protected final Map<XSComplexType, NameClass[]>
characteristicNameClasses

Map from XSComplexType to NameClass[2] that represents the names used in its child elements [0] and attributes [1].

protected final XSTermFunction<NameClass>
contentModelNameClassBuilder

Computes a name class that represents everything in a given content model.

Inherited from com.sun.tools.xjc.reader.xmlschema.ct.CTBuilder:
bgmBuilderbuildererrorReceivergreenschemasselectorsimpleTypeBuilder

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected boolean

Returns:

true if there's a collision.
checkCollision
(NameClass anc, NameClass enc, XSComplexType type)

Checks if the particles/attributes defined in the type parameter collides with the name classes of anc/enc.

protected boolean

Returns:

false If this complex type needs to be rejected.
checkIfExtensionSafe
(XSComplexType baseType, XSComplexType thisType)

Checks if this new extension is safe.

protected XSComplexType

Returns:

null If there's no such t_i or if t_i is any type.
getLastRestrictedType
(XSComplexType t)

Looks for the derivation chain t_1 > t_2 > ...

private NameClass
getNameClass(XSContentType t)

Gets a NameClass that represents all the terms in the given content type.

private NameClass
getNameClass(XSDeclaration decl)

Gets a SimpleNameClass from the name of a XSDeclaration.

Inherited from com.sun.tools.xjc.reader.xmlschema.ct.CTBuilder:
buildisApplicable

Field Detail

characteristicNameClassesback to summary
protected final Map<XSComplexType, NameClass[]> characteristicNameClasses

Map from XSComplexType to NameClass[2] that represents the names used in its child elements [0] and attributes [1].

contentModelNameClassBuilderback to summary
protected final XSTermFunction<NameClass> contentModelNameClassBuilder

Computes a name class that represents everything in a given content model.

Constructor Detail

AbstractExtendedComplexTypeBuilderback to summary
pack-priv AbstractExtendedComplexTypeBuilder()

Method Detail

checkCollisionback to summary
protected boolean checkCollision(NameClass anc, NameClass enc, XSComplexType type)

Checks if the particles/attributes defined in the type parameter collides with the name classes of anc/enc.

Returns:boolean

true if there's a collision.

checkIfExtensionSafeback to summary
protected boolean checkIfExtensionSafe(XSComplexType baseType, XSComplexType thisType)

Checks if this new extension is safe. UGLY.

If you have ctA extending ctB and ctB restricting ctC, our Java classes will look like CtAImpl extending CtBImpl extending CtCImpl.

Since a derived class unmarshaller uses the base class unmarshaller, this could potentially result in incorrect unmarshalling. We used to just reject such a case, but then we found that there are schemas that are using it.

One generalized observation that we reached is that if the extension is only adding new elements/attributes which has never been used in any of its base class (IOW, if none of the particle / attribute use / attribute wildcard can match the name of newly added elements/attributes) then it is safe to add them.

This function checks if the derivation chain to this type is not using restriction, and if it is, then checks if it is safe according to the above condition.

Returns:boolean

false If this complex type needs to be rejected.

getLastRestrictedTypeback to summary
protected XSComplexType getLastRestrictedType(XSComplexType t)

Looks for the derivation chain t_1 > t_2 > ... > t and find t_i such that t_i derives by restriction but for every j>i, t_j derives by extension.

Returns:XSComplexType

null If there's no such t_i or if t_i is any type.

getNameClassback to summary
private NameClass getNameClass(XSContentType t)

Gets a NameClass that represents all the terms in the given content type. If t is not a particle, just return an empty name class.

getNameClassback to summary
private NameClass getNameClass(XSDeclaration decl)

Gets a SimpleNameClass from the name of a XSDeclaration.