T
- the owner type of the memberS
- the type of member tokenpublic interface MemberToken<T,S extends MemberToken<T,S>> extends DeclarationToken<S>
Member
instances, with proper handling of
members on generic classes.
type members
may be created over types which mention
inference variables, or even over inference variables themselves.
Modifier and Type | Method and Description |
---|---|
BoundSet |
getBounds() |
default java.lang.Class<?> |
getDeclaringClass() |
java.lang.reflect.Member |
getMember() |
java.lang.String |
getName() |
TypeToken<? super T> |
getReceiverType()
This is the exact receiver type which this member should be accessed from or
invoked upon.
|
default Visibility |
getVisibility()
Determine the visibility of the member
|
default boolean |
isFinal() |
default boolean |
isRaw() |
default boolean |
isStatic() |
S |
resolve()
Derived a new
MemberToken instance with all associated generic
parameters inferred. |
S |
withBounds(BoundSet bounds)
Derive a new
MemberToken instance, with the given bounds incorporated
into the bounds of the underlying resolver. |
MemberToken<?,?> |
withReceiverType(java.lang.reflect.Type type)
As @see
withReceiverType(TypeToken) . |
<U> MemberToken<U,?> |
withReceiverType(TypeToken<U> type)
Derive a new instance of
MemberToken with the given owner type. |
getAllTypeArguments, getAllTypeParameterCount, getAllTypeParameters, getOwningDeclaration, getTypeArguments, getTypeParameterCount, getTypeParameters, isGeneric, resolveTypeArgument, resolveTypeArgument, withAllTypeArguments, withAllTypeArguments, withTypeArguments, withTypeArguments, withTypeArguments, withTypeArguments
java.lang.String getName()
java.lang.reflect.Member getMember()
Member
object backing the MemberToken
.BoundSet getBounds()
MemberToken
default boolean isStatic()
default boolean isFinal()
default Visibility getVisibility()
Visibility
object describing the memberdefault java.lang.Class<?> getDeclaringClass()
TypeToken<? super T> getReceiverType()
For non-static members, this type will be identical to the
owning type
.
For constructors and static members, if they are declared on a non-static inner class then the receiver type should be a subtype of the enclosing class, otherwise the receiver type should be void.
void.class
if the member has no receiver typeS withBounds(BoundSet bounds)
MemberToken
instance, with the given bounds incorporated
into the bounds of the underlying resolver. The original MemberToken
will remain unmodified.bounds
- the new bounds to incorporateMemberToken
<U> MemberToken<U,?> withReceiverType(TypeToken<U> type)
MemberToken
with the given owner type.
The new MemberToken
will always have a owner type which is as or more
specific than both the current receiver type and the given type.
This means that the new owner will be assignment compatible with the given
type, but if the given type contains wildcards or inference variables which
are less specific that those implied by the current receiver type,
new type arguments will be inferred in their place, or further bounds may be
added to them.
If the receiver type is not generic, the method will always return the same token, or will throw an exception if the given type is not a subtype of the receiver.
This may result in unsafe transformations when we convert from a raw receiver to a parameterized receiver, but declarations of those types should give a raw type warning from the Java compiler and this is considered sufficient.
type
- The new owner type. The raw type of this type must be a subtype of
the raw type of the current receiver type.MemberToken
compatible with the given owner type.
The new owner type will not be effectively more specific than the intersection type of the current owner type and the given type. That is, any type which can be assigned to both the given type and the current owner type, will also be assignable to the new type.
MemberToken<?,?> withReceiverType(java.lang.reflect.Type type)
withReceiverType(TypeToken)
.S resolve()
MemberToken
instance with all associated generic
parameters inferred.MemberToken
with inferred typesdefault boolean isRaw()
isRaw
in interface DeclarationToken<S extends MemberToken<T,S>>