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

pack-priv final Class DefaultParticleBinder

extends ParticleBinder
Class Inheritance
Imports
java.util.ArrayList, .Collection, .Collections, .HashMap, .Hashtable, .List, .Map, com.sun.tools.xjc.model.CClassInfo, .CPropertyInfo, .CReferencePropertyInfo, com.sun.tools.xjc.reader.xmlschema.bindinfo.BIProperty, com.sun.xml.xsom.XSElementDecl, .XSModelGroup, .XSModelGroupDecl, .XSParticle, .XSTerm, .XSWildcard, com.sun.xml.xsom.visitor.XSTermVisitor, java.math.BigInteger

ParticleBinder that follows the JAXB spec.
Author
Kohsuke Kawaguchi

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
DefaultParticleBinder.Builder

Builds properties by using the result computed by Checker

private class
DefaultParticleBinder.Checker

Marks particles that need to be mapped to properties, by reading customization info.

Field Summary

Inherited from com.sun.tools.xjc.reader.xmlschema.ParticleBinder:
builder

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
build(XSParticle p, Collection<XSParticle> forcedProps)

Implements abstract com.sun.tools.xjc.reader.xmlschema.ParticleBinder.build.

The version of the build method that forces a specified set of particles to become a property.

private DefaultParticleBinder.Checker
public boolean
checkFallback(XSParticle p)

Implements abstract com.sun.tools.xjc.reader.xmlschema.ParticleBinder.checkFallback.

Similar to the build method but this method only checks if the BGM that will be built by the build method will do the fallback (map all the properties into one list) or not.

Inherited from com.sun.tools.xjc.reader.xmlschema.ParticleBinder:
buildcomputeLabelgetClassSelectorgetCurrentBeangetErrorReportergetLocalCustomizationgetLocalPropCustomizationgetSpecDefaultNamemakeJavaNamemakeJavaName

Constructor Detail

DefaultParticleBinderback to summary
pack-priv DefaultParticleBinder()

Method Detail

buildback to summary
public void build(XSParticle p, Collection<XSParticle> forcedProps)

Implements abstract com.sun.tools.xjc.reader.xmlschema.ParticleBinder.build.

Doc from com.sun.tools.xjc.reader.xmlschema.ParticleBinder.build.

The version of the build method that forces a specified set of particles to become a property.

Annotations
@Override
checkCollisionback to summary
private DefaultParticleBinder.Checker checkCollision(XSParticle p, Collection<XSParticle> forcedProps)
checkFallbackback to summary
public boolean checkFallback(XSParticle p)

Implements abstract com.sun.tools.xjc.reader.xmlschema.ParticleBinder.checkFallback.

Doc from com.sun.tools.xjc.reader.xmlschema.ParticleBinder.checkFallback.

Similar to the build method but this method only checks if the BGM that will be built by the build method will do the fallback (map all the properties into one list) or not.

Annotations
@Override
com.sun.tools.xjc.reader.xmlschema back to summary

private final Class DefaultParticleBinder.Builder

extends Object
implements XSTermVisitor
Class Inheritance
  • java.lang.Object
  • com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder.Builder
All Implemented Interfaces
com.sun.xml.xsom.visitor.XSTermVisitor

Builds properties by using the result computed by Checker

Field Summary

Modifier and TypeField and Description
private boolean
insideOptionalParticle

When we are visiting inside an optional particle, this flag is set to true.

private final Map<XSParticle, String>
markedParticles

All marked particles.

Constructor Summary

AccessConstructor and Description
pack-priv
Builder(Map<XSParticle, String> markedParticles)

Method Summary

Modifier and TypeMethod and Description
public void
private String
getLabel(XSParticle p)

Gets a label of a particle.

private boolean
marked(XSParticle p)

Returns true if a particle is marked.

public void
public void
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

insideOptionalParticleback to summary
private boolean insideOptionalParticle

When we are visiting inside an optional particle, this flag is set to true.

This allows us to correctly generate primitive/boxed types.

markedParticlesback to summary
private final Map<XSParticle, String> markedParticles

All marked particles.

Constructor Detail

Builderback to summary
pack-priv Builder(Map<XSParticle, String> markedParticles)

Method Detail

elementDeclback to summary
public void elementDecl(XSElementDecl e)

Implements com.sun.xml.xsom.visitor.XSTermVisitor.elementDecl.

Annotations
@Override
getLabelback to summary
private String getLabel(XSParticle p)

Gets a label of a particle.

markedback to summary
private boolean marked(XSParticle p)

Returns true if a particle is marked.

modelGroupback to summary
public void modelGroup(XSModelGroup mg)

Implements com.sun.xml.xsom.visitor.XSTermVisitor.modelGroup.

Annotations
@Override
modelGroupDeclback to summary
public void modelGroupDecl(XSModelGroupDecl decl)

Implements com.sun.xml.xsom.visitor.XSTermVisitor.modelGroupDecl.

Annotations
@Override
particleback to summary
public void particle(XSParticle p)
wildcardback to summary
public void wildcard(XSWildcard wc)

Implements com.sun.xml.xsom.visitor.XSTermVisitor.wildcard.

Annotations
@Override
com.sun.tools.xjc.reader.xmlschema back to summary

private final Class DefaultParticleBinder.Checker

extends Object
implements XSTermVisitor
Class Inheritance
  • java.lang.Object
  • com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder.Checker
All Implemented Interfaces
com.sun.xml.xsom.visitor.XSTermVisitor

Marks particles that need to be mapped to properties, by reading customization info.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
DefaultParticleBinder.Checker.NameCollisionChecker

Checks name collisions among particles that belong to sequences.

Field Summary

Modifier and TypeField and Description
private final DefaultParticleBinder.Checker.NameCollisionChecker
cchecker

Used to check name collision.

private CollisionInfo
collisionInfo

If a collision is found, this field will be non-null.

private final Collection<XSParticle>
private final Map<XSParticle, String>
labelCache

Keep the computed label names for particles.

public final Map<XSParticle, String>
markedParticles

Marked particles.

private XSParticle
outerParticle

This field points to the parent XSParticle.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private void
check(XSParticle p)

Checks the name collision of a newly found particle.

private String
computeLabel(XSParticle p)

Hides the computeLabel method of the outer class and adds caching.

public void
pack-priv CollisionInfo
pack-priv boolean
private void
mark(XSParticle p)

Marks a particle that it's going to be mapped to a property.

public void
public void
public void
pack-priv void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ccheckerback to summary
private final DefaultParticleBinder.Checker.NameCollisionChecker cchecker

Used to check name collision.

collisionInfoback to summary
private CollisionInfo collisionInfo

If a collision is found, this field will be non-null.

forcedPropsback to summary
private final Collection<XSParticle> forcedProps
See Also
DefaultParticleBinder#build(XSParticle, Collection)
labelCacheback to summary
private final Map<XSParticle, String> labelCache

Keep the computed label names for particles.

markedParticlesback to summary
public final Map<XSParticle, String> markedParticles

Marked particles. A map from XSParticle to its label.

outerParticleback to summary
private XSParticle outerParticle

This field points to the parent XSParticle. The value is only valid when we are processing XSTerm.

Constructor Detail

Checkerback to summary
pack-priv Checker(Collection<XSParticle> forcedProps)

Method Detail

checkback to summary
private void check(XSParticle p)

Checks the name collision of a newly found particle.

computeLabelback to summary
private String computeLabel(XSParticle p)

Hides the computeLabel method of the outer class and adds caching.

elementDeclback to summary
public void elementDecl(XSElementDecl decl)

Implements com.sun.xml.xsom.visitor.XSTermVisitor.elementDecl.

Annotations
@Override
getCollisionInfoback to summary
pack-priv CollisionInfo getCollisionInfo()
hasNameCollisionback to summary
pack-priv boolean hasNameCollision()
markback to summary
private void mark(XSParticle p)

Marks a particle that it's going to be mapped to a property.

modelGroupback to summary
public void modelGroup(XSModelGroup mg)

Implements com.sun.xml.xsom.visitor.XSTermVisitor.modelGroup.

Annotations
@Override
modelGroupDeclback to summary
public void modelGroupDecl(XSModelGroupDecl decl)

Implements com.sun.xml.xsom.visitor.XSTermVisitor.modelGroupDecl.

Annotations
@Override
particleback to summary
public void particle(XSParticle p)
readSuperClassback to summary
pack-priv void readSuperClass(CClassInfo ci)
wildcardback to summary
public void wildcard(XSWildcard wc)

Implements com.sun.xml.xsom.visitor.XSTermVisitor.wildcard.

Annotations
@Override
com.sun.tools.xjc.reader.xmlschema back to summary

private final Class DefaultParticleBinder.Checker.NameCollisionChecker

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.tools.xjc.reader.xmlschema.DefaultParticleBinder.Checker.NameCollisionChecker

Checks name collisions among particles that belong to sequences.

Field Summary

Modifier and TypeField and Description
private final Map<String, CPropertyInfo>
occupiedLabels

Label names already used in the base type.

private final List<XSParticle>
particles

List of particles reported through the check method.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv CollisionInfo

Returns:

a description of a collision if a name collision is found. Otherwise null.
check
(XSParticle p)

Checks the label conflict of a particle.

private boolean

Returns:

true if the check was successful.
check
(XSParticle p1, XSParticle p2)

Checks the conflict of two particles.

pack-priv void
readSuperClass(CClassInfo base)

Reads fields of the super class and includes them to name collision tests.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

occupiedLabelsback to summary
private final Map<String, CPropertyInfo> occupiedLabels

Label names already used in the base type.

particlesback to summary
private final List<XSParticle> particles

List of particles reported through the check method.

Constructor Detail

NameCollisionCheckerback to summary
private NameCollisionChecker()

Method Detail

checkback to summary
pack-priv CollisionInfo check(XSParticle p)

Checks the label conflict of a particle. This method shall be called for each marked particle.

Returns:CollisionInfo

a description of a collision if a name collision is found. Otherwise null.

checkback to summary
private boolean check(XSParticle p1, XSParticle p2)

Checks the conflict of two particles.

Returns:boolean

true if the check was successful.

readSuperClassback to summary
pack-priv void readSuperClass(CClassInfo base)

Reads fields of the super class and includes them to name collision tests.