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 aSetOfTypes
. - Immutable: instances of this class can be created but not modified.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
An empty set of types.
-
-
Method Details
-
contains
Test whether this set contains the given type.- Parameters:
typeUtils
- aTypes
object for computing the relationships between typestype
- the type in question- Returns:
- true if this set contains
type
, or false otherwise
-
singleton
Create a set containing exactly the given type, but not its subtypes.- Parameters:
t
- the type- Returns:
- a set containing only
t
-
allSubtypes
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
Create a set representing the union of all the given sets.- Parameters:
typeSets
- an array of sets- Returns:
- the union of the given sets
-