• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java InstrumentedType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.bytebuddy.dynamic.scaffold.InstrumentedType的典型用法代码示例。如果您正苦于以下问题:Java InstrumentedType类的具体用法?Java InstrumentedType怎么用?Java InstrumentedType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InstrumentedType类属于net.bytebuddy.dynamic.scaffold包,在下文中一共展示了InstrumentedType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: ByteBuddy

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
/**
 * Creates a new Byte Buddy instance.
 *
 * @param classFileVersion             The class file version to use for types that are not based on an existing class file.
 * @param namingStrategy               The naming strategy to use.
 * @param auxiliaryTypeNamingStrategy  The naming strategy to use for naming auxiliary types.
 * @param annotationValueFilterFactory The annotation value filter factory to use.
 * @param annotationRetention          The annotation retention strategy to use.
 * @param implementationContextFactory The implementation context factory to use.
 * @param methodGraphCompiler          The method graph compiler to use.
 * @param instrumentedTypeFactory      The instrumented type factory to use.
 * @param typeValidation               Determines if a type should be explicitly validated.
 * @param ignoredMethods               A matcher for identifying methods that should be excluded from instrumentation.
 */
protected ByteBuddy(ClassFileVersion classFileVersion,
                    NamingStrategy namingStrategy,
                    AuxiliaryType.NamingStrategy auxiliaryTypeNamingStrategy,
                    AnnotationValueFilter.Factory annotationValueFilterFactory,
                    AnnotationRetention annotationRetention,
                    Implementation.Context.Factory implementationContextFactory,
                    MethodGraph.Compiler methodGraphCompiler,
                    InstrumentedType.Factory instrumentedTypeFactory,
                    TypeValidation typeValidation,
                    LatentMatcher<? super MethodDescription> ignoredMethods) {
    this.classFileVersion = classFileVersion;
    this.namingStrategy = namingStrategy;
    this.auxiliaryTypeNamingStrategy = auxiliaryTypeNamingStrategy;
    this.annotationValueFilterFactory = annotationValueFilterFactory;
    this.annotationRetention = annotationRetention;
    this.implementationContextFactory = implementationContextFactory;
    this.methodGraphCompiler = methodGraphCompiler;
    this.instrumentedTypeFactory = instrumentedTypeFactory;
    this.ignoredMethods = ignoredMethods;
    this.typeValidation = typeValidation;
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:36,代码来源:ByteBuddy.java


示例2: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Override
public InstrumentedType prepare(InstrumentedType instrumentedType) {
  // Remember the field description of the instrumented type.
  delegateField =
      instrumentedType
          .getSuperClass() // always DoFnInvokerBase
          .getDeclaredFields()
          .filter(ElementMatchers.named(FN_DELEGATE_FIELD_NAME))
          .getOnly();
  // Delegating the method call doesn't require any changes to the instrumented type.
  return instrumentedType;
}
 
开发者ID:apache,项目名称:beam,代码行数:13,代码来源:ByteBuddyDoFnInvokerFactory.java


示例3: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Override
public InstrumentedType prepare(InstrumentedType instrumentedType) {
  // Remember the field description of the instrumented type.
  // Kind of a hack to set the protected value, because the instrumentedType
  // is only available to prepare, while we need this information in
  // beforeDelegation
  delegateField =
      instrumentedType
          .getDeclaredFields() // the delegate is declared on the OnTimerInvoker
          .filter(ElementMatchers.named(FN_DELEGATE_FIELD_NAME))
          .getOnly();
  // Delegating the method call doesn't require any changes to the instrumented type.
  return instrumentedType;
}
 
开发者ID:apache,项目名称:beam,代码行数:15,代码来源:ByteBuddyOnTimerInvokerFactory.java


示例4: with

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
/**
 * Configures Byte Buddy to use the specified factory for creating {@link InstrumentedType}s. Doing so, more efficient
 * representations can be chosen when only certain operations are required. By default, all operations are supported.
 *
 * @param instrumentedTypeFactory The factory to use when creating instrumented types.
 * @return A new Byte Buddy instance that uses the supplied factory for creating instrumented types.
 */
public ByteBuddy with(InstrumentedType.Factory instrumentedTypeFactory) {
    return new ByteBuddy(classFileVersion,
            namingStrategy,
            auxiliaryTypeNamingStrategy,
            annotationValueFilterFactory,
            annotationRetention,
            implementationContextFactory,
            methodGraphCompiler,
            instrumentedTypeFactory,
            typeValidation,
            ignoredMethods);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:20,代码来源:ByteBuddy.java


示例5: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Override
public InstrumentedType prepare(InstrumentedType instrumentedType) {
    for (String value : values) {
        instrumentedType = instrumentedType.withField(new FieldDescription.Token(value,
                ENUM_FIELD_MODIFIERS | Opcodes.ACC_ENUM,
                TargetType.DESCRIPTION.asGenericType()));
    }
    return instrumentedType
            .withField(new FieldDescription.Token(ENUM_VALUES,
                    ENUM_FIELD_MODIFIERS | Opcodes.ACC_SYNTHETIC,
                    TypeDescription.ArrayProjection.of(TargetType.DESCRIPTION).asGenericType()))
            .withInitializer(new InitializationAppender(values));
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:14,代码来源:ByteBuddy.java


示例6: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Override
public InstrumentedType prepare(InstrumentedType instrumentedType) {
    return instrumentedType
            .withField(new FieldDescription.Token(fieldName,
                    Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_VOLATILE | Opcodes.ACC_SYNTHETIC,
                    INVOCATION_HANDLER_TYPE))
            .withInitializer(new LoadedTypeInitializer.ForStaticField(fieldName, invocationHandler));
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:9,代码来源:InvocationHandlerAdapter.java


示例7: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Override
public InstrumentedType prepare(InstrumentedType instrumentedType) {
    for (Implementation implementation : implementations) {
        instrumentedType = implementation.prepare(instrumentedType);
    }
    return instrumentedType;
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:8,代码来源:Implementation.java


示例8: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Override
public InstrumentedType prepare(InstrumentedType instrumentedType) {
    return instrumentedType
            .withField(new FieldDescription.Token(fieldName,
                    Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_VOLATILE | Opcodes.ACC_SYNTHETIC,
                    fieldType))
            .withInitializer(new LoadedTypeInitializer.ForStaticField(fieldName, target));
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:9,代码来源:MethodDelegation.java


示例9: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Override
public InstrumentedType prepare(InstrumentedType instrumentedType) {
    for (ArgumentLoader.Factory argumentLoader : argumentLoaders) {
        instrumentedType = argumentLoader.prepare(instrumentedType);
    }
    return targetHandler.prepare(instrumentedType);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:8,代码来源:MethodCall.java


示例10: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Override
public InstrumentedType prepare(InstrumentedType instrumentedType) {
    return instrumentedType
            .withField(new FieldDescription.Token(fieldName,
                    Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_VOLATILE | Opcodes.ACC_SYNTHETIC,
                    fieldType))
            .withInitializer(new LoadedTypeInitializer.ForStaticField(fieldName, value));
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:9,代码来源:FixedValue.java


示例11: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Override
public InstrumentedType prepare(InstrumentedType instrumentedType) {
    return instrumentedType
            .withField(new FieldDescription.Token(name,
                    Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_VOLATILE | Opcodes.ACC_SYNTHETIC,
                    fieldType.asGenericType()))
            .withInitializer(new LoadedTypeInitializer.ForStaticField(name, value));
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:9,代码来源:InvokeDynamic.java


示例12: testNonGenericResolutionIsLazyForSimpleCreationNonFrozen

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Test
public void testNonGenericResolutionIsLazyForSimpleCreationNonFrozen() throws Exception {
    ClassFileLocator classFileLocator = spy(ClassFileLocator.ForClassLoader.ofClassPath());
    new ByteBuddy()
            .with(TypeValidation.DISABLED)
            .with(MethodGraph.Empty.INSTANCE)
            .with(InstrumentedType.Factory.Default.MODIFIABLE)
            .redefine(describe(NonGenericType.class, classFileLocator, new TypePool.CacheProvider.Simple()), classFileLocator)
            .make();
    verify(classFileLocator, times(2)).locate(NonGenericType.class.getName());
    verifyNoMoreInteractions(classFileLocator);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:13,代码来源:TypePoolDefaultWithLazyResolutionTypeDescriptionTest.java


示例13: testNonGenericResolutionIsLazyForSimpleCreation

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Test
public void testNonGenericResolutionIsLazyForSimpleCreation() throws Exception {
    ClassFileLocator classFileLocator = spy(ClassFileLocator.ForClassLoader.ofClassPath());
    new ByteBuddy()
            .with(TypeValidation.DISABLED)
            .with(MethodGraph.Empty.INSTANCE)
            .with(InstrumentedType.Factory.Default.FROZEN)
            .redefine(describe(NonGenericType.class, classFileLocator, new TypePool.CacheProvider.Simple()), classFileLocator)
            .make();
    verify(classFileLocator, times(2)).locate(NonGenericType.class.getName());
    verifyNoMoreInteractions(classFileLocator);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:13,代码来源:TypePoolDefaultWithLazyResolutionTypeDescriptionTest.java


示例14: testGenericResolutionIsLazyForSimpleCreation

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Test
public void testGenericResolutionIsLazyForSimpleCreation() throws Exception {
    ClassFileLocator classFileLocator = spy(ClassFileLocator.ForClassLoader.ofClassPath());
    new ByteBuddy()
            .with(TypeValidation.DISABLED)
            .with(MethodGraph.Empty.INSTANCE)
            .with(InstrumentedType.Factory.Default.FROZEN)
            .redefine(describe(GenericType.class, classFileLocator, new TypePool.CacheProvider.Simple()), classFileLocator)
            .make();
    verify(classFileLocator, times(2)).locate(GenericType.class.getName());
    verifyNoMoreInteractions(classFileLocator);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:13,代码来源:TypePoolDefaultWithLazyResolutionTypeDescriptionTest.java


示例15: testRedefineFrozen

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testRedefineFrozen() throws Exception {
    when(byteBuddy.with(InstrumentedType.Factory.Default.FROZEN)).thenReturn(byteBuddy);
    when(byteBuddy.redefine(typeDescription, classFileLocator)).thenReturn((DynamicType.Builder) dynamicTypeBuilder);
    when(dynamicTypeBuilder.ignoreAlso(LatentMatcher.ForSelfDeclaredMethod.NOT_DECLARED)).thenReturn((DynamicType.Builder) dynamicTypeBuilder);
    assertThat(AgentBuilder.TypeStrategy.Default.REDEFINE_FROZEN.builder(typeDescription, byteBuddy, classFileLocator, methodNameTransformer),
            is((DynamicType.Builder) dynamicTypeBuilder));
    verify(byteBuddy).with(InstrumentedType.Factory.Default.FROZEN);
    verify(byteBuddy).redefine(typeDescription, classFileLocator);
    verifyNoMoreInteractions(byteBuddy);
    verify(dynamicTypeBuilder).ignoreAlso(LatentMatcher.ForSelfDeclaredMethod.NOT_DECLARED);
    verifyNoMoreInteractions(dynamicTypeBuilder);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:15,代码来源:AgentBuilderTypeStrategyTest.java


示例16: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Override
public InstrumentedType prepare(InstrumentedType instrumentedType) {
    return instrumentedType.withField(new FieldDescription.Token(FOO,
            MODIFIERS,
            TypeDescription.Generic.OBJECT,
            Collections.singletonList(AnnotationDescription.Builder.ofType(SampleAnnotation.class).define(FOO, BAR).build())));
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:8,代码来源:AbstractDynamicTypeBuilderTest.java


示例17: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Override
public InstrumentedType prepare(InstrumentedType p1) {
	return p1;
}
 
开发者ID:Mantaro,项目名称:MantaroRPG,代码行数:5,代码来源:ASMEventHandlerConstructor.java


示例18: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Override
public InstrumentedType prepare(InstrumentedType instrumentedType) {
  return instrumentedType;
}
 
开发者ID:curioswitch,项目名称:curiostack,代码行数:5,代码来源:DoWrite.java


示例19: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
@Override
public final InstrumentedType prepare(InstrumentedType instrumentedType) {
    return instrumentedType;
}
 
开发者ID:project-avral,项目名称:oo-atom,代码行数:5,代码来源:BtGenerateMethod.java


示例20: prepare

import net.bytebuddy.dynamic.scaffold.InstrumentedType; //导入依赖的package包/类
public InstrumentedType prepare(InstrumentedType instrumentedType) {
  return instrumentedType;
}
 
开发者ID:bramp,项目名称:unsafe,代码行数:4,代码来源:CopierImplementation.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Info类代码示例发布时间:2022-05-22
下一篇:
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap