下面列出了java.lang.invoke.MethodType#getClass ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Creates a new call site descriptor instance. The actual underlying class of the instance is dependent on the
* passed arguments to be space efficient; i.e. if you only use the public lookup, you'll get back an
* implementation that doesn't waste space on storing the lookup object.
* @param lookup the lookup that determines access rights at the call site. If your language runtime doesn't have
* equivalents of Java access concepts, just use {@link MethodHandles#publicLookup()}. Must not be null.
* @param name the name of the method at the call site. Must not be null.
* @param methodType the type of the method at the call site. Must not be null.
* @return a call site descriptor representing the input. Note that although the method name is "create", it will
* in fact return a weakly-referenced canonical instance.
*/
public static CallSiteDescriptor create(Lookup lookup, String name, MethodType methodType) {
name.getClass(); // NPE check
methodType.getClass(); // NPE check
lookup.getClass(); // NPE check
final String[] tokenizedName = tokenizeName(name);
if(isPublicLookup(lookup)) {
return getCanonicalPublicDescriptor(createPublicCallSiteDescriptor(tokenizedName, methodType));
}
return new LookupCallSiteDescriptor(tokenizedName, methodType, lookup);
}
/**
* Creates a new call site descriptor instance. The actual underlying class of the instance is dependent on the
* passed arguments to be space efficient; i.e. if you only use the public lookup, you'll get back an
* implementation that doesn't waste space on storing the lookup object.
* @param lookup the lookup that determines access rights at the call site. If your language runtime doesn't have
* equivalents of Java access concepts, just use {@link MethodHandles#publicLookup()}. Must not be null.
* @param name the name of the method at the call site. Must not be null.
* @param methodType the type of the method at the call site. Must not be null.
* @return a call site descriptor representing the input. Note that although the method name is "create", it will
* in fact return a weakly-referenced canonical instance.
*/
public static CallSiteDescriptor create(Lookup lookup, String name, MethodType methodType) {
name.getClass(); // NPE check
methodType.getClass(); // NPE check
lookup.getClass(); // NPE check
final String[] tokenizedName = tokenizeName(name);
if(isPublicLookup(lookup)) {
return getCanonicalPublicDescriptor(createPublicCallSiteDescriptor(tokenizedName, methodType));
}
return new LookupCallSiteDescriptor(tokenizedName, methodType, lookup);
}
/**
* Creates a new call site descriptor instance. The actual underlying class of the instance is dependent on the
* passed arguments to be space efficient; i.e. if you only use the public lookup, you'll get back an
* implementation that doesn't waste space on storing the lookup object.
* @param lookup the lookup that determines access rights at the call site. If your language runtime doesn't have
* equivalents of Java access concepts, just use {@link MethodHandles#publicLookup()}. Must not be null.
* @param name the name of the method at the call site. Must not be null.
* @param methodType the type of the method at the call site. Must not be null.
* @return a call site descriptor representing the input. Note that although the method name is "create", it will
* in fact return a weakly-referenced canonical instance.
*/
public static CallSiteDescriptor create(Lookup lookup, String name, MethodType methodType) {
name.getClass(); // NPE check
methodType.getClass(); // NPE check
lookup.getClass(); // NPE check
final String[] tokenizedName = tokenizeName(name);
if(isPublicLookup(lookup)) {
return getCanonicalPublicDescriptor(createPublicCallSiteDescriptor(tokenizedName, methodType));
}
return new LookupCallSiteDescriptor(tokenizedName, methodType, lookup);
}