public class UserUnionType extends UserSimpleType implements PlainType, UnionType
A "plain" union is a union that is not derived by restriction and whose
member types are all either atomic types or plain union types. Only plain union
types can be named in the XPath SequenceType production. (All union types, however,
can act as the target of a cast expression). This class implements the interface
PlainType
despite the fact that not all its instances represent plain
unions; to test whether a union is a plain union, use the isPlainType()
method.
SchemaComponent.ValidationStatus
ItemType.WithSequenceTypeCache
extendedTypes, finalProhibitions
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION
COMPONENT_FUNCTION_TYPE
Constructor and Description |
---|
UserUnionType(EnterpriseConfiguration config)
Creates a new Union type.
|
Modifier and Type | Method and Description |
---|---|
void |
addMemberTypeReference(TypeReference member)
Add a member type to the list of member types
|
ValidationFailure |
checkAgainstFacets(AtomicValue value,
ConversionRules rules)
Validate an atomic value, which is known to be an instance of one of the member types of the
union, against any facets (pattern facets or enumeration facets) defined at the level of the
union itself.
|
boolean |
containsListType()
Ask whether this union type includes any list types among its members
|
void |
elaborate(SchemaCompiler compiler)
Elaborate the schema component: after reloading a serialized schema component model,
this expands the component with derived information needed during validation episodes.
|
java.lang.String |
getAlphaCode()
Get an alphabetic code representing the type, or at any rate, the nearest built-in type
from which this type is derived.
|
PlainType |
getAtomizedItemType()
Get the item type of the atomic values that will be produced when an item
of this type is atomized
|
java.lang.String |
getDescription()
Get a description of this type for use in diagnostics.
|
Genre |
getGenre()
Get the genre of this item
|
java.util.List<TypeReference> |
getMemberTypeReferences()
Get the list of member types
|
java.lang.Iterable<PlainType> |
getPlainMemberTypes()
Get the list of plain types that are subsumed by this type
|
AtomicType |
getPrimitiveItemType()
Method defined in ItemType: get a primitive supertype in the ItemType type hierarchy
|
int |
getPrimitiveType()
Method defined in ItemType: get a primitive supertype in the ItemType type hierarchy
|
SequenceType |
getResultTypeOfCast()
Get the SequenceType that most accurately describes the result of casting a value to this union type
|
AtomicSequence |
getTypedValue(java.lang.CharSequence value,
NamespaceResolver resolver,
ConversionRules rules)
Get the typed value corresponding to a given string value, assuming it is
valid against this type
|
StructuredQName |
getTypeName()
Get the name of this type as a structured QName
|
UType |
getUType()
Get the corresponding
UType . |
boolean |
isAtomicType()
Ask whether this Simple Type is an atomic type
|
boolean |
isAtomizable(TypeHierarchy th)
Ask whether values of this type are atomizable
|
boolean |
isBuiltInType()
Determine whether this is a built-in type or a user-defined type
|
boolean |
isIdRefType()
Ask whether this type is an IDREF or IDREFS type.
|
boolean |
isIdType()
Ask whether this type is an ID type.
|
boolean |
isListType()
Determine whether this is a list type
|
boolean |
isNamespaceSensitive()
Test whether this type is namespace sensitive, that is, if a namespace context is needed
to translate between the lexical space and the value space.
|
boolean |
isPlainType()
Ask whether this Union type is a "plain type", defined as a union
type whose member types are all atomic types or plain unions.
|
boolean |
isTrueItemType()
Ask whether this
ItemType actually represents an item type in the XDM sense
of the term. |
boolean |
isUnionType()
Return true if this type is a union type (that is, if its variety is union)
|
void |
lookForCycles(java.util.Stack references,
SchemaCompiler compiler)
This method is called to look for cycles.
|
boolean |
matches(Item item,
TypeHierarchy th)
Test whether a given item conforms to this type
|
void |
serializeVariety(SchemaModelSerializer serializer)
Serialize the schema component
|
void |
setMemberTypeReferences(java.util.List<TypeReference> members)
Set the member types of this union type.
|
java.lang.String |
toExportString()
Return a string representation of this ItemType suitable for use in stylesheet
export files.
|
java.lang.String |
toString()
Produce a string representation of the type name.
|
boolean |
validate(SchemaCompiler compiler)
Validate this Union, replacing all unresolved forwards
references at the same time
|
ValidationFailure |
validateContent(java.lang.CharSequence value,
NamespaceResolver nsResolver,
ConversionRules rules)
Check whether a given input string is valid according to this SimpleType
|
addFacet, addInheritedFacets, analyzeContentExpression, applyWhitespaceNormalization, atomize, checkAgainstFacets, checkTypeDerivationIsOK, convertFacetValues, generateJavaScriptItemTypeAcceptor, generateJavaScriptItemTypeTest, getBuiltInBaseType, getComponentAsFunction, getComponentAsFunction, getContextComponent, getEQName, getExtendedFacetList, getFacet, getLocalFacetList, getWhitespaceAction, isSimpleType, isTypeDerivationOK, makeValidationFailure, mergeEnumerationFacets, postprocess, preprocess, serialize, setContextComponent, setFacetList
allowsDerivation, containingDeclarationIsElement, getBaseType, getBaseTypeFingerprint, getBaseTypeReference, getBlock, getContainingDeclarationName, getDerivationMethod, getDisplayName, getExtensionTypes, getFinalProhibitions, getFingerprint, getName, getNamePool, getStructuredQName, getTargetNamespace, isAnonymousType, isComplexType, isExternalType, isSameType, isSameURI, registerExtensionType, setBaseTypeReference, setContainingDeclaration, setDerivationMethod, setDerivationMethodName, setExtendedTypes, setFinalProhibitions, setTypeName
fixup, getColumnNumber, getConfiguration, getFixupStatus, getGeneratedId, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, hasSameLocation, isValidationNeeded, makeXPathExpressionPropertyRecord, saveLocation, setConfiguration, setFixupStatus, setGeneratedId, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isExternalType
explainMismatch
getBuiltInBaseType, getWhitespaceAction, isExternalType, postprocess, preprocess
allowsDerivation, analyzeContentExpression, atomize, checkTypeDerivationIsOK, getBaseType, getBlock, getDerivationMethod, getDisplayName, getEQName, getFinalProhibitions, getFingerprint, getName, getNearestNamedType, getStructuredQName, getSystemId, getTargetNamespace, isAnonymousType, isComplexType, isSameType, isSimpleType
getComponentAsFunction, getRedefinitionLevel, getValidationStatus
generateJavaScriptItemTypeAcceptor, generateJavaScriptItemTypeTest
fixup
public UserUnionType(EnterpriseConfiguration config)
config
- the Configuration for this Union (Cannot be null)public Genre getGenre()
public StructuredQName getTypeName()
PlainType
getTypeName
in interface PlainType
public void setMemberTypeReferences(java.util.List<TypeReference> members)
members
- a list of TypeReference
objectspublic void addMemberTypeReference(TypeReference member)
member
- a reference to a new member typepublic java.util.List<TypeReference> getMemberTypeReferences()
TypeReference
objectspublic boolean isAtomicType()
isAtomicType
in interface ItemType
isAtomicType
in interface SchemaType
isAtomicType
in interface SimpleType
isAtomicType
in class UserSimpleType
public boolean containsListType() throws MissingComponentException
containsListType
in interface UnionType
MissingComponentException
public boolean isPlainType()
isPlainType
in interface ItemType
public boolean isTrueItemType()
ItemType
ItemType
actually represents an item type in the XDM sense
of the term. The only instances that aren't true item types are user-defined union types
derived by restriction from other union types or containing list types in their transitive
membership ("impure union types")isTrueItemType
in interface ItemType
public SequenceType getResultTypeOfCast()
getResultTypeOfCast
in interface UnionType
public boolean isIdType() throws MissingComponentException
isIdType
in interface SchemaType
isIdType
in class UserSimpleType
MissingComponentException
public boolean isIdRefType() throws MissingComponentException
isIdRefType
in interface SchemaType
isIdRefType
in class UserSimpleType
MissingComponentException
public boolean isBuiltInType()
isBuiltInType
in interface SimpleType
public boolean isListType()
isListType
in interface SimpleType
isListType
in class UserSimpleType
public boolean isUnionType()
isUnionType
in interface SimpleType
isUnionType
in class UserSimpleType
public UType getUType()
UType
. A UType is a union of primitive item
types.public java.lang.String getAlphaCode()
getAlphaCode
in interface ItemType
public boolean isNamespaceSensitive()
isNamespaceSensitive
in interface SimpleType
public boolean validate(SchemaCompiler compiler) throws SchemaException
validate
in interface UserSchemaComponent
validate
in class UserSimpleType
compiler
- used for error reportingSchemaException
- if the definition is invalidpublic void elaborate(SchemaCompiler compiler) throws SchemaException
UserSimpleType
elaborate
in interface UserSchemaComponent
elaborate
in class UserSimpleType
compiler
- the schema compilerSchemaException
- if a fatal error occurspublic void lookForCycles(java.util.Stack references, SchemaCompiler compiler) throws SchemaException
lookForCycles
in interface UserSchemaComponent
lookForCycles
in class SchemaStructure
references
- A list of objects that contain direct or indirect references
to this object, and that must therefore not be referred to from this object.compiler
- used for error reportingSchemaException
- if cycles are foundpublic ValidationFailure validateContent(java.lang.CharSequence value, NamespaceResolver nsResolver, ConversionRules rules)
validateContent
in interface SimpleType
value
- the input string to be checkednsResolver
- a namespace resolver used to resolve namespace prefixes if the type
is namespace sensitive. The value supplied may be null; in this case any namespace-sensitive
content will throw an UnsupportedOperationException.rules
- the configuration-wide conversion rulesjava.lang.UnsupportedOperationException
- if the type is namespace-sensitive and no namespace
resolver is suppliedpublic ValidationFailure checkAgainstFacets(AtomicValue value, ConversionRules rules)
checkAgainstFacets
in interface UnionType
value
- the Atomic Value to be checked. This must be an instance of a member type of the
unionrules
- the ConversionRules for the Configurationpublic AtomicSequence getTypedValue(java.lang.CharSequence value, NamespaceResolver resolver, ConversionRules rules) throws ValidationException
SimpleType
getTypedValue
in interface SimpleType
value
- the string valueresolver
- a namespace resolver used to resolve any namespace prefixes appearing
in the content of values. Can supply null, in which case any namespace-sensitive content
will be rejected.rules
- the conversion rules from the configurationAtomicValue
,
The next() method on the iterator throws no checked exceptions, although it is not actually
declared as an UnfailingIterator.ValidationException
- if the supplied value is not in the lexical space of the data typepublic void serializeVariety(SchemaModelSerializer serializer) throws XPathException
serializeVariety
in class UserSimpleType
XPathException
public boolean matches(Item item, TypeHierarchy th)
public AtomicType getPrimitiveItemType()
getPrimitiveItemType
in interface ItemType
getPrimitiveItemType
in interface PlainType
public int getPrimitiveType()
getPrimitiveType
in interface ItemType
public PlainType getAtomizedItemType()
ItemType
getAtomizedItemType
in interface ItemType
public boolean isAtomizable(TypeHierarchy th)
ItemType
isAtomizable
in interface ItemType
th
- the type hierarchy cachepublic java.lang.Iterable<PlainType> getPlainMemberTypes() throws MissingComponentException
getPlainMemberTypes
in interface PlainType
getPlainMemberTypes
in interface UnionType
MissingComponentException
public java.lang.String toString()
toString
in interface ItemType
toString
in class UserDefinedType
public java.lang.String toExportString()
ItemType
toString()
.toExportString
in interface ItemType
public java.lang.String getDescription()
getDescription
in interface SchemaType
getDescription
in class UserDefinedType
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.