本文整理汇总了Java中jdk.internal.dynalink.support.Guards.isArray方法的典型用法代码示例。如果您正苦于以下问题:Java Guards.isArray方法的具体用法?Java Guards.isArray怎么用?Java Guards.isArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.internal.dynalink.support.Guards
的用法示例。
在下文中一共展示了Guards.isArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGuard
import jdk.internal.dynalink.support.Guards; //导入方法依赖的package包/类
private MethodHandle getGuard(final ValidationType validationType, final MethodType methodType) {
switch(validationType) {
case EXACT_CLASS: {
return getClassGuard(methodType);
}
case INSTANCE_OF: {
return getAssignableGuard(methodType);
}
case IS_ARRAY: {
return Guards.isArray(0, methodType);
}
case NONE: {
return null;
}
default: {
throw new AssertionError();
}
}
}
示例2: getGuard
import jdk.internal.dynalink.support.Guards; //导入方法依赖的package包/类
private MethodHandle getGuard(ValidationType validationType, MethodType methodType) {
switch(validationType) {
case EXACT_CLASS: {
return getClassGuard(methodType);
}
case INSTANCE_OF: {
return getAssignableGuard(methodType);
}
case IS_ARRAY: {
return Guards.isArray(0, methodType);
}
case NONE: {
return null;
}
default: {
throw new AssertionError();
}
}
}
示例3: getLengthGetter
import jdk.internal.dynalink.support.Guards; //导入方法依赖的package包/类
private GuardedInvocationComponent getLengthGetter(final CallSiteDescriptor callSiteDescriptor) {
assertParameterCount(callSiteDescriptor, 1);
final MethodType callSiteType = callSiteDescriptor.getMethodType();
final Class<?> declaredType = callSiteType.parameterType(0);
// If declared type of receiver at the call site is already an array, collection, or map, bind without guard.
// Thing is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance
// they're dealing with an array, collection, or map, but hey...
if(declaredType.isArray()) {
return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType));
} else if(Collection.class.isAssignableFrom(declaredType)) {
return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType));
} else if(Map.class.isAssignableFrom(declaredType)) {
return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType));
}
// Otherwise, create a binding based on the actual type of the argument with an appropriate guard.
if(clazz.isArray()) {
return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType), Guards.isArray(0,
callSiteType), ValidationType.IS_ARRAY);
} if(Collection.class.isAssignableFrom(clazz)) {
return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType), Guards.asType(
COLLECTION_GUARD, callSiteType), Collection.class, ValidationType.INSTANCE_OF);
} if(Map.class.isAssignableFrom(clazz)) {
return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType), Guards.asType(MAP_GUARD,
callSiteType), Map.class, ValidationType.INSTANCE_OF);
}
// Can't retrieve length for objects that are neither arrays, nor collections, nor maps.
return null;
}
示例4: getLengthGetter
import jdk.internal.dynalink.support.Guards; //导入方法依赖的package包/类
private GuardedInvocationComponent getLengthGetter(CallSiteDescriptor callSiteDescriptor) {
assertParameterCount(callSiteDescriptor, 1);
final MethodType callSiteType = callSiteDescriptor.getMethodType();
final Class<?> declaredType = callSiteType.parameterType(0);
// If declared type of receiver at the call site is already an array, collection, or map, bind without guard.
// Thing is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance
// they're dealing with an array, collection, or map, but hey...
if(declaredType.isArray()) {
return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType));
} else if(Collection.class.isAssignableFrom(declaredType)) {
return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType));
} else if(Map.class.isAssignableFrom(declaredType)) {
return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType));
}
// Otherwise, create a binding based on the actual type of the argument with an appropriate guard.
if(clazz.isArray()) {
return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType), Guards.isArray(0,
callSiteType), ValidationType.IS_ARRAY);
} if(Collection.class.isAssignableFrom(clazz)) {
return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType), Guards.asType(
COLLECTION_GUARD, callSiteType), Collection.class, ValidationType.INSTANCE_OF);
} if(Map.class.isAssignableFrom(clazz)) {
return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType), Guards.asType(MAP_GUARD,
callSiteType), Map.class, ValidationType.INSTANCE_OF);
}
// Can't retrieve length for objects that are neither arrays, nor collections, nor maps.
return null;
}