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


Java InstrumentedType类代码示例

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


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


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