本文整理匯總了Java中java.lang.invoke.MethodType.getClass方法的典型用法代碼示例。如果您正苦於以下問題:Java MethodType.getClass方法的具體用法?Java MethodType.getClass怎麽用?Java MethodType.getClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.invoke.MethodType
的用法示例。
在下文中一共展示了MethodType.getClass方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: create
import java.lang.invoke.MethodType; //導入方法依賴的package包/類
/**
* 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(final Lookup lookup, final String name, final 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);
}