public class ComponentExtension extends BaseExtension
Modifier and Type | Field and Description |
---|---|
private ComponentCustom |
m_custom
Customization information for this component.
|
private GlobalExtension |
m_global
Containing global definition extension.
|
private boolean |
m_optional
Optional component flag.
|
private QName |
m_overrideType
Override for type specified in schema (
null if none). |
private boolean |
m_removed
Component dropped from schema definition.
|
private boolean |
m_repeated
Repeated component flag.
|
private int |
m_useCount
Number of times a component is used in code generation.
|
private static Logger |
s_logger
Logger for class.
|
ARITY_OPTIONAL_COLLECTION, ARITY_OPTIONAL_SINGLETON, ARITY_REQUIRED_COLLECTION, ARITY_REQUIRED_SINGLETON
Constructor and Description |
---|
ComponentExtension(OpenAttrBase comp,
GlobalExtension global)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
applyAndCountUsage(ValidationContext vctx)
Apply extensions to schema definition component, deleting components flagged for skipping and substituting types
as configured.
|
private boolean |
checkReference(OpenAttrBase comp)
Check a reference to a component.
|
int |
getAnyType()
Get the xs:any handling type code to be applied for this component.
|
java.lang.String |
getBaseName()
Get base name for corresponding property.
|
int |
getChoiceType()
Get the xs:choice handling type code to be applied for this component.
|
java.lang.String |
getClassName()
Get name to be used for generated class.
|
private NestingCustomBase |
getContainingCustom()
Get the innermost customization which applies to this component.
|
(package private) ComponentCustom |
getCustom()
Get customization information for this component.
|
GlobalExtension |
getGlobal()
Get the containing global extension.
|
QName |
getOverrideType()
Get override type.
|
int |
getUnionType()
Get the xs:union handling type code to be applied for this component.
|
int |
getUseCount()
Get the use count for the component.
|
int |
incrementUseCount()
Increment the use count for the component.
|
boolean |
isChoiceExposed()
Check if xs:choice selection state should be exposed for this component.
|
boolean |
isIgnored()
Check if component is to be ignored.
|
boolean |
isInlined()
Check if schema component is to be generated inline.
|
boolean |
isOptional()
Check if optional component.
|
boolean |
isRemoved()
Check if component to be removed from schema.
|
boolean |
isRepeated()
Check if repeated component.
|
boolean |
isSeparateClass()
Check if schema component is to be generated as a separate class.
|
boolean |
isUnionExposed()
Check if xs:union selection state should be exposed for this component.
|
protected boolean |
normalize(int depth)
Normalize the child schema definition.
|
private void |
removeChild(int index)
Remove a child element.
|
private QName |
replaceAndReference(QName type,
ValidationContext vctx)
Check for type substitution on a type reference, then record the reference.
|
(package private) void |
setCustom(ComponentCustom custom)
Set customization information for this component.
|
void |
setOptional(boolean optional)
Set optional component.
|
void |
setOverrideType(QName qname)
Set override type.
|
void |
setRemoved(boolean removed)
Set flag for component to be removed from schema.
|
void |
setRepeated(boolean repeated)
Set repeated component.
|
private boolean |
substituteTypeDerivation(java.lang.String lead,
OpenAttrBase topcomp,
OpenAttrBase childcomp,
CommonTypeDerivation derive)
Try to replace type definition with substitute type from derivation.
|
getComponent, getReplacementType, setTypeReplacer
private static final Logger s_logger
private final GlobalExtension m_global
private boolean m_removed
private boolean m_optional
private boolean m_repeated
private ComponentCustom m_custom
private QName m_overrideType
null
if none).private int m_useCount
public ComponentExtension(OpenAttrBase comp, GlobalExtension global)
comp
- global
- containing global definition extension (null
allowed only as special case when
calling this constructor from the global extension subclass constructor)public boolean isRemoved()
public void setRemoved(boolean removed)
removed
- public boolean isIgnored()
public boolean isOptional()
public void setOptional(boolean optional)
optional
- public boolean isRepeated()
public void setRepeated(boolean repeated)
repeated
- public boolean isInlined()
true
if inlined, false
if notpublic boolean isSeparateClass()
true
if separate class, false
if notpublic GlobalExtension getGlobal()
public QName getOverrideType()
null
if none)public void setOverrideType(QName qname)
qname
- type name (null
if none)public int incrementUseCount()
public int getUseCount()
public java.lang.String getClassName()
null
if not set)public java.lang.String getBaseName()
null
if not set)ComponentCustom getCustom()
void setCustom(ComponentCustom custom)
custom
- private NestingCustomBase getContainingCustom()
public int getAnyType()
NestingCustomBase.ANY_DOM
if not overridden at any level.public int getChoiceType()
NestingCustomBase.SELECTION_CHECKEDSET
if not overridden at any level.public boolean isChoiceExposed()
public int getUnionType()
NestingCustomBase.SELECTION_CHECKEDSET
if not overridden at any level.public boolean isUnionExposed()
private QName replaceAndReference(QName type, ValidationContext vctx)
type
- original typevctx
- validation contextnull
if to be deleted)private boolean checkReference(OpenAttrBase comp)
false
. If the component has not been deleted it counts the reference on that component, and records
the dependency from this component before returning true
. For convenience, this may be called with a
null
argument, which just returns true
.comp
- component (call ignored if null
)true
if reference to be kept, false
if deletedprivate void removeChild(int index)
index
- public void applyAndCountUsage(ValidationContext vctx)
vctx
- validation contextprivate boolean substituteTypeDerivation(java.lang.String lead, OpenAttrBase topcomp, OpenAttrBase childcomp, CommonTypeDerivation derive)
lead
- prefix text for indentation of logging messagestopcomp
- schema component being normalizedchildcomp
- current child of schema component being normalizedderive
- type derivation supplying substitute typetrue
if type modified, false
if notprotected boolean normalize(int depth)
depth
- nesting depth for validationtrue
if any part of tree under this component modified, false
if not