Package net.sf.saxon.type
Interface UnionType
- All Superinterfaces:
ItemType,SchemaComponent,SchemaType,SimpleType
- All Known Implementing Classes:
ErrorType,NumericType
Interface representing a union type. This may be either a built-in union type (of which there are
currently two, namely ErrorType and NumericType), or a user-defined union type.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.sf.saxon.type.ItemType
ItemType.WithSequenceTypeCacheNested classes/interfaces inherited from interface net.sf.saxon.type.SchemaComponent
SchemaComponent.ValidationStatus -
Field Summary
Fields inherited from interface net.sf.saxon.type.SchemaType
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION -
Method Summary
Modifier and TypeMethodDescriptioncheckAgainstFacets(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.booleanAsk whether the union contains a list type among its member typesexplainMismatch(Item item, TypeHierarchy th) Get extra diagnostic information about why a supplied item does not conform to this item type, if available.Get the "plain" types in the transitive membership.Get the result type of a cast operation to this union type, as a sequence type.Methods inherited from interface net.sf.saxon.type.ItemType
generateJavaScriptItemTypeAcceptor, generateJavaScriptItemTypeTest, getAlphaCode, getAtomizedItemType, getGenre, getPrimitiveItemType, getPrimitiveType, getUType, isAtomicType, isAtomizable, isPlainType, isTrueItemType, matches, toExportString, toStringMethods inherited from interface net.sf.saxon.type.SchemaComponent
getRedefinitionLevel, getValidationStatusMethods inherited from interface net.sf.saxon.type.SchemaType
allowsDerivation, analyzeContentExpression, atomize, checkTypeDerivationIsOK, getBaseType, getBlock, getDerivationMethod, getDescription, getDisplayName, getEQName, getFinalProhibitions, getFingerprint, getName, getNearestNamedType, getStructuredQName, getSystemId, getTargetNamespace, isAnonymousType, isComplexType, isIdRefType, isIdType, isSameType, isSimpleTypeMethods inherited from interface net.sf.saxon.type.SimpleType
getBuiltInBaseType, getTypedValue, getWhitespaceAction, isAtomicType, isBuiltInType, isExternalType, isListType, isNamespaceSensitive, isUnionType, postprocess, preprocess, validateContent
-
Method Details
-
containsListType
Ask whether the union contains a list type among its member types- Returns:
- true of one of the member types is a list type
- Throws:
MissingComponentException
-
getPlainMemberTypes
Get the "plain" types in the transitive membership. Plain types are atomic types and union types that are defined directly in terms of other plain types, without adding any restriction facets.- Returns:
- the atomic types and plain union types in the transitive membership of the union type.
- Throws:
MissingComponentException
-
getResultTypeOfCast
SequenceType getResultTypeOfCast()Get the result type of a cast operation to this union type, as a sequence type.- Returns:
- the result type of casting, as precisely as possible. For example, if all the member types of the union are derived from the same primitive type, this will return that primitive type.
-
checkAgainstFacets
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.- Parameters:
value- the Atomic Value to be checked. This must be an instance of a member type of the unionrules- the ConversionRules for the Configuration- Returns:
- a ValidationFailure if the value is not valid; null if it is valid.
-
explainMismatch
Get extra diagnostic information about why a supplied item does not conform to this item type, if available. If extra information is returned, it should be in the form of a complete sentence, minus the closing full stop. No information should be returned for obvious cases.- Specified by:
explainMismatchin interfaceItemType- Parameters:
item- the item that doesn't match this typeth- the type hierarchy cache- Returns:
- optionally, a message explaining why the item does not match the type
-