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


Java MethodDescription类代码示例

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


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

示例1: getIncludes

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public ElementMatcher<MethodDescription> getIncludes() {
    return not(ElementMatchers.<MethodDescription>isPrivate()
            .or(ObjectMethodElementMatchers.INSTANCE)
            .or(named("close"))
            .or(named("getDB"))
            .or(named("getClient"))
            .or(named("connect"))
            .or(named("setDataSource"))
            .or(named("resetState"))
            .or(named("clusterSlots"))
            .or(named("isConnected"))
            .or(named("ping"))
            .or(named("quit"))
            .or(named("checkIsInMultiOrPipeline")));
}
 
开发者ID:YanXs,项目名称:nighthawk,代码行数:18,代码来源:JaRedisMethodInclusion.java

示例2: matchAnyMethodIn

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
/**
 * Returns a byte buddy matcher matching any method contained in methodSignatures.
 */
public static ElementMatcher<MethodDescription> matchAnyMethodIn(Set<MethodSignature> methodSignatures) {
    ElementMatcher.Junction<MethodDescription> methodMatcher = ElementMatchers.none();
    for (MethodSignature methodSignature : methodSignatures) {
        ElementMatcher.Junction<MethodDescription> junction = ElementMatchers
                .named(methodSignature.getMethodName())
                .and(not(isAbstract()))
                .and(isPublic())
                .and(takesArguments(methodSignature.getParameterTypes().size()));
        for (int i = 0; i < methodSignature.getParameterTypes().size(); i++) {
            junction = junction.and(takesArgument(i, named(methodSignature.getParameterTypes().get(i))));
        }
        methodMatcher = methodMatcher.or(junction);
    }
    return methodMatcher;
}
 
开发者ID:fstab,项目名称:promagent,代码行数:19,代码来源:Promagent.java

示例3: matches

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
@Override
public final boolean matches(TypeDescription target) {
    MethodList<MethodDescription.InDefinedShape> methodsToCheck = target.getDeclaredMethods()
            .filter(not(isConstructor()))
            .filter(isPublic())
            .filter(not(isStatic()))
            .filter(not(isBridge()))
            .filter(not(named("equals")))
            .filter(not(named("hashCode")))
            .filter(not(named("toString")));
    
    for(MethodDescription md : methodsToCheck) {
        if(!md.isFinal()) {
            return false;
        }
    }
    return true;
}
 
开发者ID:project-avral,项目名称:oo-atom,代码行数:19,代码来源:AllMethodsAreFinal.java

示例4: SmtBoxTest

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
public SmtBoxTest() {
    super(
        new TestCase(
            "attempt to box non-primitive must fail",
            new AssertResultIsErroneous(
                new SmtBox(
                    new TypeDescription.ForLoadedType(Object.class)
                ),
                "Attempt to box non-primitive type java.lang.Object"
            )
        ),
        new TestCase(
            "can box integer primitive", 
            new AssertTokenToRepresentExpectedStackManipulation(
                new SmtBox(
                    new TypeDescription.ForLoadedType(int.class)
                ),
                () -> MethodInvocation.invoke(new MethodDescription.ForLoadedMethod(INT_VALUEOF))
            )
        )
    );
}
 
开发者ID:project-avral,项目名称:oo-atom,代码行数:23,代码来源:SmtBoxTest.java

示例5: SmtBoxFieldTest

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
public SmtBoxFieldTest() {
    super(
        new TestCase(
            "generates no bytecode for non-primitive fields",
            new AssertTokensToRepresentIdenticalBytecode(
                new SmtBoxField(
                    new FieldDescription.ForLoadedField(
                        NON_PRIMITIVE_FIELD
                    )
                ),
                new SmtDoNothing()
            )
        ),
        new TestCase(
            "boxes primitive fields",
            new AssertTokenToRepresentExpectedStackManipulation(
                new SmtBoxField(
                    new FieldDescription.ForLoadedField(
                        PRIMITIVE_FIELD
                    )
                ),
                () -> MethodInvocation.invoke(new MethodDescription.ForLoadedMethod(INT_VALUEOF))
            )
        )
    );
}
 
开发者ID:project-avral,项目名称:oo-atom,代码行数:27,代码来源:SmtBoxFieldTest.java

示例6: elementMatcher

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
private ElementMatcher.Junction<MethodDescription> elementMatcher() {
    switch (this) {
        case Private: {
            return isPrivate();
        }
        case Default: {
            return isPackagePrivate();
        }
        case Public: {
            return isPublic();
        }
        case Protected: {
            return isProtected();
        }
        default:
            return isPublic();
    }
}
 
开发者ID:O2O-Market,项目名称:Market-monitor,代码行数:19,代码来源:MethodMatcher.java

示例7: beforeDelegation

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
@Override
protected StackManipulation beforeDelegation(MethodDescription instrumentedMethod) {
  // Parameters of the wrapper invoker method:
  //   DoFnInvoker.ArgumentProvider
  // Parameters of the wrapped DoFn method:
  //   [DoFn.ProcessContext, BoundedWindow, InputProvider, OutputReceiver] in any order
  ArrayList<StackManipulation> pushParameters = new ArrayList<>();

  // To load the delegate, push `this` and then access the field
  StackManipulation pushDelegate =
      new StackManipulation.Compound(
          MethodVariableAccess.REFERENCE.loadFrom(0),
          FieldAccess.forField(delegateField).read());

  StackManipulation pushExtraContextFactory = MethodVariableAccess.REFERENCE.loadFrom(1);

  // Push the arguments in their actual order.
  for (DoFnSignature.Parameter param : signature.extraParameters()) {
    pushParameters.add(
        new StackManipulation.Compound(
            pushExtraContextFactory, getExtraContextParameter(param, pushDelegate)));
  }
  return new StackManipulation.Compound(pushParameters);
}
 
开发者ID:apache,项目名称:beam,代码行数:25,代码来源:ByteBuddyDoFnInvokerFactory.java

示例8: UserCodeMethodInvocation

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
UserCodeMethodInvocation(
    @Nullable Integer returnVarIndex,
    MethodDescription targetMethod,
    MethodDescription instrumentedMethod) {
  this.returnVarIndex = returnVarIndex;
  this.targetMethod = targetMethod;
  this.instrumentedMethod = instrumentedMethod;
  this.returnType = targetMethod.getReturnType().asErasure();

  boolean targetMethodReturnsVoid = TypeDescription.VOID.equals(returnType);
  checkArgument(
      (returnVarIndex == null) == targetMethodReturnsVoid,
      "returnVarIndex should be defined if and only if the target method has a return value");

  try {
    createUserCodeException =
        new MethodDescription.ForLoadedMethod(
            UserCodeException.class.getDeclaredMethod("wrap", Throwable.class));
  } catch (NoSuchMethodException | SecurityException e) {
    throw new RuntimeException("Unable to find UserCodeException.wrap", e);
  }
}
 
开发者ID:apache,项目名称:beam,代码行数:23,代码来源:ByteBuddyDoFnInvokerFactory.java

示例9: beforeDelegation

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
@Override
protected StackManipulation beforeDelegation(MethodDescription instrumentedMethod) {
  // Parameters of the wrapper invoker method:
  //   DoFn.ArgumentProvider
  // Parameters of the wrapped DoFn method:
  //   a dynamic set of allowed "extra" parameters in any order subject to
  //   validation prior to getting the DoFnSignature
  ArrayList<StackManipulation> parameters = new ArrayList<>();

  // To load the delegate, push `this` and then access the field
  StackManipulation pushDelegate =
      new StackManipulation.Compound(
          MethodVariableAccess.REFERENCE.loadFrom(0),
          FieldAccess.forField(delegateField).read());

  StackManipulation pushExtraContextFactory = MethodVariableAccess.REFERENCE.loadFrom(1);

  // Push the extra arguments in their actual order.
  for (DoFnSignature.Parameter param : signature.extraParameters()) {
    parameters.add(
        new StackManipulation.Compound(
            pushExtraContextFactory,
            ByteBuddyDoFnInvokerFactory.getExtraContextParameter(param, pushDelegate)));
  }
  return new StackManipulation.Compound(parameters);
}
 
开发者ID:apache,项目名称:beam,代码行数:27,代码来源:ByteBuddyOnTimerInvokerFactory.java

示例10: getInstanceMethodsInterceptPoints

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
    return new InstanceMethodsInterceptPoint[] {
        new InstanceMethodsInterceptPoint() {
            @Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named(CONSUMER_MESSAGE_METHOD);
            }

            @Override public String getMethodsInterceptor() {
                return INTERCEPTOR_CLASS;
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:18,代码来源:ConsumeMessageConcurrentlyInstrumentation.java

示例11: isMatch

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
@Override
public boolean isMatch(TypeDescription typeDescription) {
    for (MethodDescription.InDefinedShape methodDescription : typeDescription.getDeclaredMethods()) {
        List<String> annotationList = new ArrayList<String>(Arrays.asList(annotations));

        AnnotationList declaredAnnotations = methodDescription.getDeclaredAnnotations();
        for (AnnotationDescription annotation : declaredAnnotations) {
            annotationList.remove(annotation.getAnnotationType().getActualName());
        }
        if (annotationList.isEmpty()) {
            return true;
        }
    }

    return false;
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:17,代码来源:MethodAnnotationMatch.java

示例12: getInstanceMethodsInterceptPoints

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
/**
 * @return the collection of {@link InstanceMethodsInterceptPoint}, represent the intercepted methods and their
 * interceptors.
 */
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
    return new InstanceMethodsInterceptPoint[] {
        new InstanceMethodsInterceptPoint() {
            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("convert");
            }

            @Override
            public String getMethodsInterceptor() {
                return "PrintTraceIdInterceptor";
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:25,代码来源:TraceIdPatternConverterActivation.java

示例13: getInstanceMethodsInterceptPoints

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
    return new InstanceMethodsInterceptPoint[] {
        new InstanceMethodsInterceptPoint() {
            @Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named(ENHANCE_METHOD);
            }

            @Override public String getMethodsInterceptor() {
                return INTERCEPT_CLASS;
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:18,代码来源:StreamingServerCallHandlerInstrumentation.java

示例14: getInstanceMethodsInterceptPoints

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
/**
 * @return the collection of {@link StaticMethodsInterceptPoint}, represent the intercepted methods and their
 * interceptors.
 */
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
    return new InstanceMethodsInterceptPoint[] {
        new InstanceMethodsInterceptPoint() {
            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("convert");
            }

            @Override
            public String getMethodsInterceptor() {
                return "PrintTraceIdInterceptor";
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:25,代码来源:LogbackPatternConverterActivation.java

示例15: getInstanceMethodsInterceptPoints

import net.bytebuddy.description.method.MethodDescription; //导入依赖的package包/类
@Override
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
    return new InstanceMethodsInterceptPoint[] {
        new InstanceMethodsInterceptPoint() {
            @Override
            public ElementMatcher<MethodDescription> getMethodsMatcher() {
                return named("convertTID");
            }

            @Override
            public String getMethodsInterceptor() {
                return "PrintMDCTraceIdInterceptor";
            }

            @Override public boolean isOverrideArgs() {
                return false;
            }
        }
    };
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:21,代码来源:MDCConverterActivation.java


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