Interface UnionType

    • Method Detail

      • getPlainMemberTypes

        java.util.List<? extends PlainType> getPlainMemberTypes()
                                                         throws MissingComponentException
        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.
      • getTypedValue

        AtomicSequence getTypedValue​(UnicodeString value,
                                     NamespaceResolver resolver,
                                     ConversionRules rules)
                              throws ValidationException
        Get the typed value corresponding to a given string value, assuming it is valid against this type
        Parameters:
        value - the string value
        resolver - 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 configuration
        Returns:
        the atomic sequence comprising the typed value. The objects returned by this SequenceIterator will all be of type AtomicValue,
        Throws:
        ValidationException - if the supplied value is not in the lexical space of the data type
      • checkAgainstFacets

        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.
        Parameters:
        value - the Atomic Value to be checked. This must be an instance of a member type of the union
        rules - the ConversionRules for the Configuration
        Returns:
        a ValidationFailure if the value is not valid; null if it is valid.
      • explainMismatch

        default java.util.Optional<java.lang.String> explainMismatch​(Item item,
                                                                     TypeHierarchy th)
        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:
        explainMismatch in interface ItemType
        Parameters:
        item - the item that doesn't match this type
        th - the type hierarchy cache
        Returns:
        optionally, a message explaining why the item does not match the type
      • getDescription

        default java.lang.String getDescription()