public abstract class MemberSelectorListMemberAccessPolicy extends java.lang.Object implements MemberAccessPolicy
There are two ways you can add members to the member selector list:
Members are identified with the following data (with the example of
com.example.MyClassin the example)
myMethodin the example), except for constructors where it's unused
int, intin the example), except for fields where it's unused
If a method or field is matched in the upper bound type, it will be automatically matched in all subtypes of that.
It's called "upper bound" type, because the member will only be matched in classes that are
the upper bound class. That restriction stands even if the member was inherited from another type (class or
interface), and it wasn't even overridden in the upper bound type; the member won't be matched in the
type where it was inherited from, if that type is more generic than the upper bound type.
The above inheritance rule doesn't apply to constructors. That's consistent with the fact constructors aren't
inherited in Java (or pretty much any other language). So for example, if you add
the member selector list, and
B extends A, then
com.example.B.B() is still not matched by that list.
If you want it to be matched, you have to add
com.example.B.B() to list explicitly.
Note that the return type of methods aren't used in any way. If
myMethod(int, int) has multiple variants
with different return types (which is possible on the bytecode level) but the same parameter types, then all
variants of it is matched, or none is. Similarly, the type of fields isn't used either, only the name of the field
|Modifier and Type||Class and Description|
A condition that matches some type members.
|Modifier and Type||Method and Description|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public final ClassMemberAccessPolicy forClass(java.lang.Class<?> contextClass)
ClassMemberAccessPolicythat encapsulates the member access policy for a given class.
ClassMemberAccessPolicyimplementations need not be thread-safe. Because class introspection results are cached, and so this method is usually only called once for a given class, the
ClassMemberAccessPolicyinstances shouldn't be cached by the implementation of this method.