public class ReferenceArgument extends TypeArgument
Modifier and Type | Field and Description |
---|---|
private ReferenceType |
referenceType
The reference type for this argument.
|
Modifier | Constructor and Description |
---|---|
private |
ReferenceArgument(ReferenceType referenceType)
Creates a
ReferenceArgument for the given ReferenceType . |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(TypeArgument otherArgument)
Checks whether this type argument contains another argument, using relationship defined in JLS Section
4.5.1.
|
boolean |
equals(@Nullable java.lang.Object obj) |
static ReferenceArgument |
forType(ReferenceType referenceType) |
static ReferenceArgument |
forType(java.lang.reflect.Type type)
Creates a
ReferenceArgument from the given type. |
java.lang.String |
getBinaryName()
Return the binary name.
|
java.lang.String |
getFqName()
Return the fully-qualified name.
|
@Nullable Substitution |
getInstantiatingSubstitution(TypeArgument otherArgument)
Returns a unifying substitution.
|
ReferenceType |
getReferenceType()
Get the reference type for this type argument.
|
java.util.List<TypeVariable> |
getTypeParameters()
The type parameters for this type argument.
|
boolean |
hasCaptureVariable()
Indicate whether this type argument has a capture variable.
|
int |
hashCode() |
boolean |
hasWildcard()
Indicate whether this type argument has a wildcard.
|
boolean |
isGeneric(boolean ignoreWildcards)
Indicates whether a
ReferenceArgument is generic. |
(package private) boolean |
isInstantiationOfTypeArgument(TypeArgument otherArgument)
Determines whether this type argument is an instantiation of the other argument.
|
boolean |
isVariable()
Indicate whether this type argument is a type variable.
|
TypeArgument |
substitute(Substitution substitution)
Applies the type substitution to this type argument.
|
java.lang.String |
toString() |
isGeneric, isWildcard
private final ReferenceType referenceType
private ReferenceArgument(ReferenceType referenceType)
ReferenceArgument
for the given ReferenceType
.referenceType
- the ReferenceType
public static ReferenceArgument forType(java.lang.reflect.Type type)
ReferenceArgument
from the given type.type
- the typeReferenceArgument
for the given typepublic static ReferenceArgument forType(ReferenceType referenceType)
public boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getFqName()
TypeArgument
getFqName
in class TypeArgument
public java.lang.String getBinaryName()
TypeArgument
getBinaryName
in class TypeArgument
public java.lang.String toString()
toString
in class java.lang.Object
public TypeArgument substitute(Substitution substitution)
TypeArgument
substitute
in class TypeArgument
substitution
- the substitutionpublic boolean contains(TypeArgument otherArgument)
Considers cases:
T
contains T
T
contains ? extends T
T
contains ? super T
contains
in class TypeArgument
otherArgument
- the other TypeArgument
public ReferenceType getReferenceType()
public java.util.List<TypeVariable> getTypeParameters()
TypeArgument
getTypeParameters
in class TypeArgument
public boolean hasWildcard()
TypeArgument
hasWildcard
in class TypeArgument
public boolean hasCaptureVariable()
TypeArgument
hasCaptureVariable
in class TypeArgument
public boolean isGeneric(boolean ignoreWildcards)
ReferenceArgument
is generic.isGeneric
in class TypeArgument
ignoreWildcards
- if true, ignore wildcards; that is, treat wildcards as not making the
operation genericReferenceType
is generic, false otherwiseboolean isInstantiationOfTypeArgument(TypeArgument otherArgument)
TypeArgument
isInstantiationOfTypeArgument
in class TypeArgument
otherArgument
- the other argumentInstantiatedType.isInstantiationOf(ReferenceType)
public @Nullable Substitution getInstantiatingSubstitution(TypeArgument otherArgument)
TypeArgument
getInstantiatingSubstitution
in class TypeArgument
otherArgument
- the generic type for which a substitution is neededpublic boolean isVariable()
TypeArgument
isVariable
in class TypeArgument