本文整理汇总了Java中jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker类的典型用法代码示例。如果您正苦于以下问题:Java TypeBasedGuardingDynamicLinker类的具体用法?Java TypeBasedGuardingDynamicLinker怎么用?Java TypeBasedGuardingDynamicLinker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeBasedGuardingDynamicLinker类属于jdk.internal.dynalink.linker包,在下文中一共展示了TypeBasedGuardingDynamicLinker类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeValue
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; //导入依赖的package包/类
@SuppressWarnings("fallthrough")
@Override
protected List<TypeBasedGuardingDynamicLinker> computeValue(final Class<?> clazz) {
List<TypeBasedGuardingDynamicLinker> list = NO_LINKER;
for(int i = 0; i < linkers.length; ++i) {
final TypeBasedGuardingDynamicLinker linker = linkers[i];
if(linker.canLinkType(clazz)) {
switch(list.size()) {
case 0: {
list = singletonLinkers[i];
break;
}
case 1: {
list = new LinkedList<>(list);
}
default: {
list.add(linker);
}
}
}
}
return list;
}
示例2: addTypeBased
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; //导入依赖的package包/类
private static void addTypeBased(final List<GuardingDynamicLinker> llinkers,
final List<TypeBasedGuardingDynamicLinker> tblinkers) {
switch(tblinkers.size()) {
case 0: {
break;
}
case 1: {
llinkers.addAll(tblinkers);
tblinkers.clear();
break;
}
default: {
llinkers.add(new CompositeTypeBasedGuardingDynamicLinker(tblinkers));
tblinkers.clear();
break;
}
}
}
示例3: computeValue
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; //导入依赖的package包/类
@Override
protected List<TypeBasedGuardingDynamicLinker> computeValue(Class<?> clazz) {
List<TypeBasedGuardingDynamicLinker> list = NO_LINKER;
for(int i = 0; i < linkers.length; ++i) {
final TypeBasedGuardingDynamicLinker linker = linkers[i];
if(linker.canLinkType(clazz)) {
switch(list.size()) {
case 0: {
list = singletonLinkers[i];
break;
}
case 1: {
list = new LinkedList<>(list);
}
//$FALL-THROUGH$
default: {
list.add(linker);
}
}
}
}
return list;
}
示例4: addTypeBased
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; //导入依赖的package包/类
private static void addTypeBased(List<GuardingDynamicLinker> llinkers,
List<TypeBasedGuardingDynamicLinker> tblinkers) {
switch(tblinkers.size()) {
case 0: {
break;
}
case 1: {
llinkers.addAll(tblinkers);
tblinkers.clear();
break;
}
default: {
llinkers.add(new CompositeTypeBasedGuardingDynamicLinker(tblinkers));
tblinkers.clear();
break;
}
}
}
示例5: computeValue
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; //导入依赖的package包/类
@Override
protected TypeBasedGuardingDynamicLinker computeValue(final Class<?> clazz) {
// If ClassValue.put() were public, we could just pre-populate with these known mappings...
return
clazz == Class.class ? new ClassLinker() :
clazz == StaticClass.class ? new StaticClassLinker() :
DynamicMethod.class.isAssignableFrom(clazz) ? new DynamicMethodLinker() :
new BeanLinker(clazz);
}
示例6: getReadableInstancePropertyNames
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; //导入依赖的package包/类
/**
* Returns a collection of names of all readable instance properties of a class.
* @param clazz the class
* @return a collection of names of all readable instance properties of a class.
*/
public static Collection<String> getReadableInstancePropertyNames(final Class<?> clazz) {
final TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
if(linker instanceof BeanLinker) {
return ((BeanLinker)linker).getReadablePropertyNames();
}
return Collections.emptySet();
}
示例7: getWritableInstancePropertyNames
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; //导入依赖的package包/类
/**
* Returns a collection of names of all writable instance properties of a class.
* @param clazz the class
* @return a collection of names of all writable instance properties of a class.
*/
public static Collection<String> getWritableInstancePropertyNames(final Class<?> clazz) {
final TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
if(linker instanceof BeanLinker) {
return ((BeanLinker)linker).getWritablePropertyNames();
}
return Collections.emptySet();
}
示例8: getInstanceMethodNames
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; //导入依赖的package包/类
/**
* Returns a collection of names of all instance methods of a class.
* @param clazz the class
* @return a collection of names of all instance methods of a class.
*/
public static Collection<String> getInstanceMethodNames(final Class<?> clazz) {
final TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
if(linker instanceof BeanLinker) {
return ((BeanLinker)linker).getMethodNames();
}
return Collections.emptySet();
}
示例9: ClassToLinker
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
ClassToLinker(final TypeBasedGuardingDynamicLinker[] linkers) {
this.linkers = linkers;
singletonLinkers = new List[linkers.length];
for(int i = 0; i < linkers.length; ++i) {
singletonLinkers[i] = Collections.singletonList(linkers[i]);
}
}
示例10: CompositeTypeBasedGuardingDynamicLinker
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; //导入依赖的package包/类
/**
* Creates a new composite type-based linker.
*
* @param linkers the component linkers
*/
public CompositeTypeBasedGuardingDynamicLinker(final Iterable<? extends TypeBasedGuardingDynamicLinker> linkers) {
final List<TypeBasedGuardingDynamicLinker> l = new LinkedList<>();
for(final TypeBasedGuardingDynamicLinker linker: linkers) {
l.add(linker);
}
this.classToLinker = new ClassToLinker(l.toArray(new TypeBasedGuardingDynamicLinker[l.size()]));
}
示例11: getGuardedInvocation
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; //导入依赖的package包/类
@Override
public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest, final LinkerServices linkerServices)
throws Exception {
final Object obj = linkRequest.getReceiver();
if(obj == null) {
return null;
}
for(final TypeBasedGuardingDynamicLinker linker: classToLinker.get(obj.getClass())) {
final GuardedInvocation invocation = linker.getGuardedInvocation(linkRequest, linkerServices);
if(invocation != null) {
return invocation;
}
}
return null;
}
示例12: optimize
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker; //导入依赖的package包/类
/**
* Optimizes a list of type-based linkers. If a group of adjacent linkers in the list all implement
* {@link TypeBasedGuardingDynamicLinker}, they will be replaced with a single instance of
* {@link CompositeTypeBasedGuardingDynamicLinker} that contains them.
*
* @param linkers the list of linkers to optimize
* @return the optimized list
*/
public static List<GuardingDynamicLinker> optimize(final Iterable<? extends GuardingDynamicLinker> linkers) {
final List<GuardingDynamicLinker> llinkers = new LinkedList<>();
final List<TypeBasedGuardingDynamicLinker> tblinkers = new LinkedList<>();
for(final GuardingDynamicLinker linker: linkers) {
if(linker instanceof TypeBasedGuardingDynamicLinker) {
tblinkers.add((TypeBasedGuardingDynamicLinker)linker);
} else {
addTypeBased(llinkers, tblinkers);
llinkers.add(linker);
}
}
addTypeBased(llinkers, tblinkers);
return llinkers;
}