Home » openjdk-7 » java.lang.invoke » [javadoc | source]
java.lang.invoke
final class: MemberName [javadoc | source]
java.lang.Object
   java.lang.invoke.MemberName

All Implemented Interfaces:
    Member, Cloneable

A {@code MemberName} is a compact symbolic datum which fully characterizes a method or field reference. A member name refers to a field, method, constructor, or member type. Every member name has a simple name (a string) and a type (either a Class or MethodType). A member name may also have a non-null declaring class, or it may be simply a naked name/type pair. A member name may also have non-zero modifier flags. Finally, a member name may be either resolved or unresolved. If it is resolved, the existence of the named

Whether resolved or not, a member name provides no access rights or invocation capability to its possessor. It is merely a compact representation of all symbolic information necessary to link to and properly use the named member.

When resolved, a member name's internal implementation may include references to JVM metadata. This representation is stateless and only decriptive. It provides no private information and no capability to use the member.

By contrast, a {@linkplain java.lang.reflect.Method} contains fuller information about the internals of a method (except its bytecodes) and also allows invocation. A MemberName is much lighter than a Method, since it contains about 7 fields to the 16 of Method (plus its sub-arrays), and those seven fields omit much of the information in Method.

Nested Class Summary:
static class  MemberName.Factory  A factory type for resolving member names with the help of the VM. TBD: Define access-safe public constructors for this factory. 
Field Summary
static final  int BRIDGE     
static final  int VARARGS     
static final  int SYNTHETIC     
static final  int ANNOTATION     
static final  int ENUM     
static final  String CONSTRUCTOR_NAME     
static final  int RECOGNIZED_MODIFIERS     
static final  int IS_METHOD     
static final  int IS_CONSTRUCTOR     
static final  int IS_FIELD     
static final  int IS_TYPE     
static final  int SEARCH_SUPERCLASSES     
static final  int SEARCH_INTERFACES     
static final  int ALL_ACCESS     
static final  int ALL_KINDS     
static final  int IS_INVOCABLE     
static final  int IS_FIELD_OR_METHOD     
static final  int SEARCH_ALL_SUPERS     
Constructor:
 MemberName() 
 public MemberName(Method m) 
    Create a name for the given reflected method. The resulting name will be in a resolved state.
 public MemberName(Constructor ctor) 
    Create a name for the given reflected constructor. The resulting name will be in a resolved state.
 public MemberName(Field fld) 
    Create a name for the given reflected field. The resulting name will be in a resolved state.
 public MemberName(Class<?> type) 
    Create a name for the given class. The resulting name will be in a resolved state.
 public MemberName(Class<?> defClass,
    String name,
    Class<?> type) 
    Create a field or type name from the given components: Declaring class, name, type. The declaring class may be supplied as null if this is to be a bare name and type. The modifier flags default to zero. The resulting name will in an unresolved state.
 public MemberName(Class<?> defClass,
    String name,
    MethodType type) 
    Create a method or constructor name from the given components: Declaring class, name, type, modifiers. It will be a constructor if and only if the name is {@code "<init>"}. The declaring class may be supplied as null if this is to be a bare name and type. The modifier flags default to zero. The resulting name will in an unresolved state.
 public MemberName(Class<?> defClass,
    String name,
    Class<?> type,
    int modifiers) 
    Create a field or type name from the given components: Declaring class, name, type, modifiers. The declaring class may be supplied as null if this is to be a bare name and type. The resulting name will in an unresolved state.
 public MemberName(Class<?> defClass,
    String name,
    MethodType type,
    int modifiers) 
    Create a method or constructor name from the given components: Declaring class, name, type, modifiers. It will be a constructor if and only if the name is {@code "<init>"}. The declaring class may be supplied as null if this is to be a bare name and type. The resulting name will in an unresolved state.
Method from java.lang.invoke.MemberName Summary:
clone,   getClassLoader,   getDeclaringClass,   getFactory,   getFieldType,   getInvocationType,   getMethodType,   getModifiers,   getName,   getParameterTypes,   getReturnType,   getSignature,   getType,   getVMIndex,   hasReceiverTypeDispatch,   isAbstract,   isBridge,   isConstructor,   isField,   isFieldOrMethod,   isFinal,   isInvocable,   isMethod,   isPackage,   isPrivate,   isProtected,   isPublic,   isResolved,   isStatic,   isSynthetic,   isType,   isVarargs,   makeAccessException,   makeAccessException,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.lang.invoke.MemberName Detail:
 protected MemberName clone() 
 public ClassLoader getClassLoader() 
    Utility method producing the class loader of the declaring class.
 public Class<?> getDeclaringClass() 
    Return the declaring class of this member. In the case of a bare name and type, the declaring class will be null.
 static Factory getFactory() 
    Actually making a query requires an access check.
 public Class<?> getFieldType() 
    Return the declared type of this member, which must be a field or type. If it is a type member, that type itself is returned.
 public MethodType getInvocationType() 
    Return the actual type under which this method or constructor must be invoked. For non-static methods or constructors, this is the type with a leading parameter, a reference to declaring class. For static methods, it is the same as the declared type.
 public MethodType getMethodType() 
    Return the declared type of this member, which must be a method or constructor.
 public int getModifiers() 
    Return the modifier flags of this member.
 public String getName() 
    Return the simple name of this member. For a type, it is the same as Class#getSimpleName . For a method or field, it is the simple name of the member. For a constructor, it is always {@code "<init>"}.
 public Class<?>[] getParameterTypes() 
    Utility method producing the parameter types of the method type.
 public Class<?> getReturnType() 
    Utility method producing the return type of the method type.
 public String getSignature() 
    Utility method to produce the signature of this member, used within the class file format to describe its type.
 public Object getType() 
    Utility method to produce either the method type or field type of this member.
 int getVMIndex() 
    Document?
 public boolean hasReceiverTypeDispatch() 
    Query whether this member name is resolved to a non-static, non-final method.
 public boolean isAbstract() 
    Utility method to query the modifier flags of this member.
 public boolean isBridge() 
    Utility method to query the modifier flags of this member; returns false if the member is not a method.
 public boolean isConstructor() 
    Query whether this member is a constructor.
 public boolean isField() 
    Query whether this member is a field.
 public boolean isFieldOrMethod() 
    Utility method to query whether this member is a method, constructor, or field.
 public boolean isFinal() 
    Utility method to query the modifier flags of this member.
 public boolean isInvocable() 
    Utility method to query whether this member is a method or constructor.
 public boolean isMethod() 
    Query whether this member is a method.
 public boolean isPackage() 
    Utility method to query whether this member is neither public, private, nor protected.
 public boolean isPrivate() 
    Utility method to query the modifier flags of this member.
 public boolean isProtected() 
    Utility method to query the modifier flags of this member.
 public boolean isPublic() 
    Utility method to query the modifier flags of this member.
 public boolean isResolved() 
    Query whether this member name is resolved. A resolved member name is one for which the JVM has found a method, constructor, field, or type binding corresponding exactly to the name. (Document?)
 public boolean isStatic() 
    Utility method to query the modifier flags of this member.
 public boolean isSynthetic() 
    Utility method to query the modifier flags of this member; returns false if the member is not a method.
 public boolean isType() 
    Query whether this member is a type.
 public boolean isVarargs() 
    Utility method to query the modifier flags of this member; returns false if the member is not a method.
 public ReflectiveOperationException makeAccessException() 
 public IllegalAccessException makeAccessException(String message,
    Object from) 
 public String toString() 
    Produce a string form of this member name. For types, it is simply the type's own string (as reported by {@code toString}). For fields, it is {@code "DeclaringClass.name/type"}. For methods and constructors, it is {@code "DeclaringClass.name(ptype...)rtype"}. If the declaring class is null, the prefix {@code "DeclaringClass."} is omitted. If the member is unresolved, a prefix {@code "*."} is prepended.