Package com.sun.xml.xsom.impl
Class ElementDecl
- java.lang.Object
-
- com.sun.xml.xsom.impl.ComponentImpl
-
- com.sun.xml.xsom.impl.DeclarationImpl
-
- com.sun.xml.xsom.impl.ElementDecl
-
- All Implemented Interfaces:
Ref.Term
,XSComponent
,XSDeclaration
,XSElementDecl
,XSTerm
public class ElementDecl extends DeclarationImpl implements XSElementDecl, Ref.Term
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
_abstract
private XmlString
defaultValue
private XmlString
fixedValue
private java.lang.Boolean
form
private java.util.List<XSIdentityConstraint>
idConstraints
private boolean
nillable
private int
substDisallowed
private int
substExcluded
private Ref.Element
substHead
private java.util.Set<XSElementDecl>
substitutables
Set that represents element decls that can substitute this element.private java.util.Set<XSElementDecl>
substitutablesView
Unmodifieable view ofsubstitutables
.private Ref.Type
type
-
Fields inherited from class com.sun.xml.xsom.impl.ComponentImpl
ownerDocument
-
-
Constructor Summary
Constructors Constructor Description ElementDecl(PatcherManager reader, SchemaDocumentImpl owner, AnnotationImpl _annon, org.xml.sax.Locator _loc, ForeignAttributesImpl fa, java.lang.String _tns, java.lang.String _name, boolean _anonymous, XmlString _defv, XmlString _fixedv, boolean _nillable, boolean _abstract, java.lang.Boolean _form, Ref.Type _type, Ref.Element _substHead, int _substDisallowed, int _substExcluded, java.util.List<IdentityConstraintImpl> idConstraints)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addSubstitutable(ElementDecl decl)
java.lang.Object
apply(XSFunction function)
Accepts a functor.java.lang.Object
apply(XSTermFunction function)
<T,P>
Tapply(XSTermFunctionWithParam<T,P> function, P param)
XSElementDecl
asElementDecl()
XSModelGroup
asModelGroup()
XSModelGroupDecl
asModelGroupDecl()
XSWildcard
asWildcard()
boolean
canBeSubstitutedBy(XSElementDecl e)
Returns true if this element declaration can be validly substituted by the given declaration.XmlString
getDefaultValue()
XmlString
getFixedValue()
java.lang.Boolean
getForm()
Used for javadoc schema generationjava.util.List<XSIdentityConstraint>
getIdentityConstraints()
Returns all theXSIdentityConstraint
s in this element decl.XSElementDecl
getSubstAffiliation()
Gets the substitution head of this element, if any.java.util.Set<? extends XSElementDecl>
getSubstitutables()
Returns the element declarations that can substitute this element.XSTerm
getTerm()
Obtains a reference as a term.XSType
getType()
Gets the type of this element declaration.boolean
isAbstract()
boolean
isElementDecl()
boolean
isModelGroup()
boolean
isModelGroupDecl()
boolean
isNillable()
boolean
isSubstitutionDisallowed(int method)
Checks the diallowed substitution property of the schema component.boolean
isSubstitutionExcluded(int method)
Checks the substitution excluded property of the schema component.boolean
isWildcard()
XSElementDecl[]
listSubstitutables()
Deprecated.void
updateSubstitutabilityMap()
void
visit(XSTermVisitor visitor)
void
visit(XSVisitor visitor)
Accepts a visitor.-
Methods inherited from class com.sun.xml.xsom.impl.DeclarationImpl
getName, getTargetNamespace, isAnonymous, isGlobal, isLocal
-
Methods inherited from class com.sun.xml.xsom.impl.ComponentImpl
getAnnotation, getAnnotation, getForeignAttribute, getForeignAttributes, getLocator, getOwnerSchema, getRoot, getSourceDocument, select, selectSingle, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.sun.xml.xsom.XSComponent
getAnnotation, getAnnotation, getForeignAttribute, getForeignAttributes, getLocator, getOwnerSchema, getRoot, getSourceDocument, select, selectSingle
-
Methods inherited from interface com.sun.xml.xsom.XSDeclaration
getName, getTargetNamespace, isAnonymous, isGlobal, isLocal
-
-
-
-
Field Detail
-
defaultValue
private XmlString defaultValue
-
fixedValue
private XmlString fixedValue
-
nillable
private boolean nillable
-
_abstract
private boolean _abstract
-
type
private Ref.Type type
-
substHead
private Ref.Element substHead
-
substDisallowed
private int substDisallowed
-
substExcluded
private int substExcluded
-
idConstraints
private final java.util.List<XSIdentityConstraint> idConstraints
-
form
private java.lang.Boolean form
-
substitutables
private java.util.Set<XSElementDecl> substitutables
Set that represents element decls that can substitute this element.
-
substitutablesView
private java.util.Set<XSElementDecl> substitutablesView
Unmodifieable view ofsubstitutables
.
-
-
Constructor Detail
-
ElementDecl
public ElementDecl(PatcherManager reader, SchemaDocumentImpl owner, AnnotationImpl _annon, org.xml.sax.Locator _loc, ForeignAttributesImpl fa, java.lang.String _tns, java.lang.String _name, boolean _anonymous, XmlString _defv, XmlString _fixedv, boolean _nillable, boolean _abstract, java.lang.Boolean _form, Ref.Type _type, Ref.Element _substHead, int _substDisallowed, int _substExcluded, java.util.List<IdentityConstraintImpl> idConstraints)
-
-
Method Detail
-
getDefaultValue
public XmlString getDefaultValue()
- Specified by:
getDefaultValue
in interfaceXSElementDecl
-
getFixedValue
public XmlString getFixedValue()
- Specified by:
getFixedValue
in interfaceXSElementDecl
-
isNillable
public boolean isNillable()
- Specified by:
isNillable
in interfaceXSElementDecl
-
isAbstract
public boolean isAbstract()
- Specified by:
isAbstract
in interfaceXSElementDecl
-
getType
public XSType getType()
Description copied from interface:XSElementDecl
Gets the type of this element declaration.- Specified by:
getType
in interfaceXSElementDecl
- Returns:
- always non-null.
-
getSubstAffiliation
public XSElementDecl getSubstAffiliation()
Description copied from interface:XSElementDecl
Gets the substitution head of this element, if any. Otherwise null.- Specified by:
getSubstAffiliation
in interfaceXSElementDecl
-
isSubstitutionDisallowed
public boolean isSubstitutionDisallowed(int method)
Description copied from interface:XSElementDecl
Checks the diallowed substitution property of the schema component. IOW, this checks the value of theblock
attribute (plusblockDefault
).- Specified by:
isSubstitutionDisallowed
in interfaceXSElementDecl
- Parameters:
method
- Possible values areXSType.EXTENSION
,XSType.RESTRICTION
, orXSType.SUBSTITUTION
-
isSubstitutionExcluded
public boolean isSubstitutionExcluded(int method)
Description copied from interface:XSElementDecl
Checks the substitution excluded property of the schema component. IOW, this checks the value of thefinal
attribute (plusfinalDefault
).- Specified by:
isSubstitutionExcluded
in interfaceXSElementDecl
- Parameters:
method
- Possible values areXSType.EXTENSION
orXSType.RESTRICTION
.
-
getIdentityConstraints
public java.util.List<XSIdentityConstraint> getIdentityConstraints()
Description copied from interface:XSElementDecl
Returns all theXSIdentityConstraint
s in this element decl.- Specified by:
getIdentityConstraints
in interfaceXSElementDecl
- Returns:
- never null, but can be empty.
-
getForm
public java.lang.Boolean getForm()
Description copied from interface:XSElementDecl
Used for javadoc schema generation- Specified by:
getForm
in interfaceXSElementDecl
- Returns:
- null if form attribute not present, true if form attribute present and set to qualified, false if form attribute present and set to unqualified.
-
listSubstitutables
public XSElementDecl[] listSubstitutables()
Deprecated.Description copied from interface:XSElementDecl
Returns the element declarations that can substitute this element.IOW, this set returns all the element decls that satisfies the "Substitution Group OK" constraint.
- Specified by:
listSubstitutables
in interfaceXSElementDecl
- Returns:
- nun-null valid array. The return value always contains this element decl itself.
-
getSubstitutables
public java.util.Set<? extends XSElementDecl> getSubstitutables()
Description copied from interface:XSElementDecl
Returns the element declarations that can substitute this element.IOW, this set returns all the element decls that satisfies the "Substitution Group OK" constraint.
Note that the above clause does NOT check for abstract elements. So abstract elements may still show up in the returned set.
- Specified by:
getSubstitutables
in interfaceXSElementDecl
- Returns:
- nun-null unmodifiable list. The returned list always contains this element decl itself.
-
addSubstitutable
protected void addSubstitutable(ElementDecl decl)
-
updateSubstitutabilityMap
public void updateSubstitutabilityMap()
-
canBeSubstitutedBy
public boolean canBeSubstitutedBy(XSElementDecl e)
Description copied from interface:XSElementDecl
Returns true if this element declaration can be validly substituted by the given declaration.Just a short cut of getSubstitutables().contain(e);
- Specified by:
canBeSubstitutedBy
in interfaceXSElementDecl
-
isWildcard
public boolean isWildcard()
- Specified by:
isWildcard
in interfaceXSTerm
-
isModelGroupDecl
public boolean isModelGroupDecl()
- Specified by:
isModelGroupDecl
in interfaceXSTerm
-
isModelGroup
public boolean isModelGroup()
- Specified by:
isModelGroup
in interfaceXSTerm
-
isElementDecl
public boolean isElementDecl()
- Specified by:
isElementDecl
in interfaceXSTerm
-
asWildcard
public XSWildcard asWildcard()
- Specified by:
asWildcard
in interfaceXSTerm
-
asModelGroupDecl
public XSModelGroupDecl asModelGroupDecl()
- Specified by:
asModelGroupDecl
in interfaceXSTerm
-
asModelGroup
public XSModelGroup asModelGroup()
- Specified by:
asModelGroup
in interfaceXSTerm
-
asElementDecl
public XSElementDecl asElementDecl()
- Specified by:
asElementDecl
in interfaceXSTerm
-
visit
public void visit(XSVisitor visitor)
Description copied from interface:XSComponent
Accepts a visitor.- Specified by:
visit
in interfaceXSComponent
-
visit
public void visit(XSTermVisitor visitor)
-
apply
public java.lang.Object apply(XSTermFunction function)
-
apply
public <T,P> T apply(XSTermFunctionWithParam<T,P> function, P param)
-
apply
public java.lang.Object apply(XSFunction function)
Description copied from interface:XSComponent
Accepts a functor.- Specified by:
apply
in interfaceXSComponent
-
-