当前位置: 首页>>代码示例>>Java>>正文


Java ClassFileVersion.isAtLeast方法代码示例

本文整理汇总了Java中net.bytebuddy.ClassFileVersion.isAtLeast方法的典型用法代码示例。如果您正苦于以下问题:Java ClassFileVersion.isAtLeast方法的具体用法?Java ClassFileVersion.isAtLeast怎么用?Java ClassFileVersion.isAtLeast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.bytebuddy.ClassFileVersion的用法示例。


在下文中一共展示了ClassFileVersion.isAtLeast方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compile

import net.bytebuddy.ClassFileVersion; //导入方法依赖的package包/类
@Override
public MethodRegistry.Compiled compile(Implementation.Target.Factory implementationTargetFactory, ClassFileVersion classFileVersion) {
    Map<Handler, Handler.Compiled> compilationCache = new HashMap<Handler, Handler.Compiled>();
    Map<MethodAttributeAppender.Factory, MethodAttributeAppender> attributeAppenderCache = new HashMap<MethodAttributeAppender.Factory, MethodAttributeAppender>();
    LinkedHashMap<MethodDescription, Compiled.Entry> entries = new LinkedHashMap<MethodDescription, Compiled.Entry>();
    Implementation.Target implementationTarget = implementationTargetFactory.make(instrumentedType, methodGraph, classFileVersion);
    for (Map.Entry<MethodDescription, Entry> entry : implementations.entrySet()) {
        Handler.Compiled cachedHandler = compilationCache.get(entry.getValue().getHandler());
        if (cachedHandler == null) {
            cachedHandler = entry.getValue().getHandler().compile(implementationTarget);
            compilationCache.put(entry.getValue().getHandler(), cachedHandler);
        }
        MethodAttributeAppender cachedAttributeAppender = attributeAppenderCache.get(entry.getValue().getAppenderFactory());
        if (cachedAttributeAppender == null) {
            cachedAttributeAppender = entry.getValue().getAppenderFactory().make(instrumentedType);
            attributeAppenderCache.put(entry.getValue().getAppenderFactory(), cachedAttributeAppender);
        }
        entries.put(entry.getKey(), new Compiled.Entry(cachedHandler,
                cachedAttributeAppender,
                entry.getValue().getMethodDescription(),
                entry.getValue().resolveBridgeTypes(),
                entry.getValue().getVisibility(),
                entry.getValue().isBridgeMethod()));
    }
    return new Compiled(instrumentedType,
            loadedTypeInitializer,
            typeInitializer,
            methods,
            entries,
            classFileVersion.isAtLeast(ClassFileVersion.JAVA_V5));
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:32,代码来源:MethodRegistry.java

示例2: visit

import net.bytebuddy.ClassFileVersion; //导入方法依赖的package包/类
@Override
public void visit(int version, int modifiers, String name, String signature, String superName, String[] interfaces) {
    ClassFileVersion classFileVersion = ClassFileVersion.ofMinorMajor(version);
    List<Constraint> constraints = new ArrayList<Constraint>();
    constraints.add(new Constraint.ForClassFileVersion(classFileVersion));
    if (name.endsWith('/' + PackageDescription.PACKAGE_CLASS_NAME)) {
        constraints.add(Constraint.ForPackageType.INSTANCE);
    } else if ((modifiers & Opcodes.ACC_ANNOTATION) != 0) {
        if (!classFileVersion.isAtLeast(ClassFileVersion.JAVA_V5)) {
            throw new IllegalStateException("Cannot define an annotation type for class file version " + classFileVersion);
        }
        constraints.add(classFileVersion.isAtLeast(ClassFileVersion.JAVA_V8)
                ? Constraint.ForAnnotation.JAVA_8
                : Constraint.ForAnnotation.CLASSIC);
    } else if ((modifiers & Opcodes.ACC_INTERFACE) != 0) {
        constraints.add(classFileVersion.isAtLeast(ClassFileVersion.JAVA_V8)
                ? Constraint.ForInterface.JAVA_8
                : Constraint.ForInterface.CLASSIC);
    } else if ((modifiers & Opcodes.ACC_ABSTRACT) != 0) {
        constraints.add(Constraint.ForClass.ABSTRACT);
    } else {
        constraints.add(Constraint.ForClass.MANIFEST);
    }
    constraint = new Constraint.Compound(constraints);
    constraint.assertType(modifiers, interfaces != null, signature != null);
    super.visit(version, modifiers, name, signature, superName, interfaces);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:28,代码来源:TypeWriter.java

示例3: of

import net.bytebuddy.ClassFileVersion; //导入方法依赖的package包/类
/**
 * Resolves a default method invocation depending on the class file version permitting such calls.
 *
 * @param classFileVersion The class file version to resolve for.
 * @return A suitable default method invocation mode.
 */
public static DefaultMethodInvocation of(ClassFileVersion classFileVersion) {
    return classFileVersion.isAtLeast(ClassFileVersion.JAVA_V8)
            ? ENABLED
            : DISABLED;
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:12,代码来源:Implementation.java


注:本文中的net.bytebuddy.ClassFileVersion.isAtLeast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。