本文整理汇总了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);
}