Interface Type

All Known Implementing Classes:
ArrayType, AtomType, FuncType, ListType, MapType, NodeType

public interface Type
XQuery types.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Type IDs for client/server communication.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the atomic type.
    Casts the specified Java value to this type.
    Casts the specified item to this type.
    Casts the specified string to this type.
    boolean
    eq(Type type)
    Checks if this type is equal to the given one.
    id()
    Returns a type id to differentiate all types.
    boolean
    Checks if the current type is an instance of the specified type.
    Computes the intersection between this type and the given one, i.e.
    boolean
    Checks if items with this type are numbers.
    boolean
    Checks if items with this type are numbers or untyped.
    boolean
    Checks if items of this type are sortable.
    boolean
    Checks if items of this type are strings or untyped.
    boolean
    Checks if items with this type are untyped.
    boolean
    Checks if the type is namespace-sensitive.
    default boolean
    oneOf(Type... types)
    Checks if this is one of the specified types.
    default Type
    refine(Expr expr)
    Returns the given type, or the type of the specified expression if it is more specific.
    default SeqType
    Returns a sequence type with a single number of occurrence.
    seqType(Occ occ)
    Internal function for creating a sequence type with the specified occurrence indicator.
     
    union(Type type)
    Computes the union between this type and the given one, i.e.
  • Method Details

    • cast

      Value cast(Item item, QueryContext qc, StaticContext sc, InputInfo ii) throws QueryException
      Casts the specified item to this type.
      Parameters:
      item - item to be converted
      qc - query context
      sc - static context
      ii - input info
      Returns:
      cast value
      Throws:
      QueryException - query exception
    • cast

      Value cast(Object value, QueryContext qc, StaticContext sc, InputInfo ii) throws QueryException
      Casts the specified Java value to this type.
      Parameters:
      value - Java value
      qc - query context
      sc - static context
      ii - input info
      Returns:
      cast value
      Throws:
      QueryException - query exception
    • castString

      Value castString(String value, QueryContext qc, StaticContext sc, InputInfo ii) throws QueryException
      Casts the specified string to this type.
      Parameters:
      value - string object
      qc - query context
      sc - static context
      ii - input info
      Returns:
      cast value
      Throws:
      QueryException - query exception
    • seqType

      default SeqType seqType()
      Returns a sequence type with a single number of occurrence.
      Returns:
      sequence type
    • seqType

      SeqType seqType(Occ occ)
      Internal function for creating a sequence type with the specified occurrence indicator.
      Parameters:
      occ - occurrence indicator
      Returns:
      sequence type
      See Also:
    • oneOf

      default boolean oneOf(Type... types)
      Checks if this is one of the specified types.
      Parameters:
      types - types
      Returns:
      result of check
    • eq

      boolean eq(Type type)
      Checks if this type is equal to the given one.
      Parameters:
      type - other type
      Returns:
      true if both types are equal, false otherwise
    • instanceOf

      boolean instanceOf(Type type)
      Checks if the current type is an instance of the specified type.
      Parameters:
      type - type to be checked
      Returns:
      result of check
    • union

      Type union(Type type)
      Computes the union between this type and the given one, i.e. the least common ancestor of both types in the type hierarchy.
      Parameters:
      type - other type
      Returns:
      union type
    • intersect

      Type intersect(Type type)
      Computes the intersection between this type and the given one, i.e. the least specific type that is sub-type of both types. If no such type exists, null is returned.
      Parameters:
      type - other type
      Returns:
      intersection type or null
    • isNumber

      boolean isNumber()
      Checks if items with this type are numbers.
      Returns:
      result of check
    • isUntyped

      boolean isUntyped()
      Checks if items with this type are untyped.
      Returns:
      result of check
    • isNumberOrUntyped

      boolean isNumberOrUntyped()
      Checks if items with this type are numbers or untyped.
      Returns:
      result of check
    • isStringOrUntyped

      boolean isStringOrUntyped()
      Checks if items of this type are strings or untyped. Returns if this item is untyped or a string.
      Returns:
      result of check
    • isSortable

      boolean isSortable()
      Checks if items of this type are sortable.
      Returns:
      result of check
    • atomic

      AtomType atomic()
      Returns the atomic type.
      Returns:
      atomic type (can be null, e.g. for function types)
    • id

      Type.ID id()
      Returns a type id to differentiate all types.
      Returns:
      id
    • nsSensitive

      boolean nsSensitive()
      Checks if the type is namespace-sensitive.
      Returns:
      result of check
    • refine

      default Type refine(Expr expr)
      Returns the given type, or the type of the specified expression if it is more specific.
      Parameters:
      expr - expression
      Returns:
      node type
    • toString

      String toString()
      Overrides:
      toString in class Object