Interface SetOfTypes


public interface SetOfTypes
A set of types.

Important properties of this class:

  • No defined equality: in general, equality between these sets is prohibitively difficult to compute, and therefore this class uses reference equality.
  • Unknown size: it is not possible to know the true size of a set like allSubtypes(TypeMirror). By extension, it is not possible to iterate over a SetOfTypes.
  • Immutable: instances of this class can be created but not modified.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final SetOfTypes
    An empty set of types.
  • Method Summary

    Modifier and Type
    Method
    Description
    static SetOfTypes
    Create a set containing the given type and all of its subtypes.
    static SetOfTypes
    anyOfTheseNames(com.google.common.collect.ImmutableSet<@CanonicalName String> names)
    Create a set containing exactly the types with the given names, but not their subtypes.
    boolean
    contains(Types typeUtils, TypeMirror type)
    Test whether this set contains the given type.
    static SetOfTypes
    Create a set containing exactly the given type, but not its subtypes.
    static SetOfTypes
    union(SetOfTypes... typeSets)
    Create a set representing the union of all the given sets.
  • Field Details

    • EMPTY

      static final SetOfTypes EMPTY
      An empty set of types.
  • Method Details

    • contains

      @Pure boolean contains(Types typeUtils, TypeMirror type)
      Test whether this set contains the given type.
      Parameters:
      typeUtils - a Types object for computing the relationships between types
      type - the type in question
      Returns:
      true if this set contains type, or false otherwise
    • singleton

      @Pure static SetOfTypes singleton(TypeMirror t)
      Create a set containing exactly the given type, but not its subtypes.
      Parameters:
      t - the type
      Returns:
      a set containing only t
    • allSubtypes

      @Pure static SetOfTypes allSubtypes(TypeMirror t)
      Create a set containing the given type and all of its subtypes.
      Parameters:
      t - the type
      Returns:
      a set containing t and its subtypes
    • anyOfTheseNames

      @Pure static SetOfTypes anyOfTheseNames(com.google.common.collect.ImmutableSet<@CanonicalName String> names)
      Create a set containing exactly the types with the given names, but not their subtypes.
      Parameters:
      names - the type names
      Returns:
      a set containing only the named types
    • union

      @Pure static SetOfTypes union(SetOfTypes... typeSets)
      Create a set representing the union of all the given sets.
      Parameters:
      typeSets - an array of sets
      Returns:
      the union of the given sets