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


Java MethodDescription.ForLoadedMethod方法代码示例

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


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

示例1: 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

示例2: getEnumDescriptor

import net.bytebuddy.description.method.MethodDescription; //导入方法依赖的package包/类
/**
 * Returns a {@link StackManipulation} that returns the {@link
 * com.google.protobuf.Descriptors.EnumDescriptor} for the given enum field.
 */
static StackManipulation getEnumDescriptor(ProtoFieldInfo info) {
  Class<?> clz = info.enumClass();
  final MethodDescription.ForLoadedMethod getDescriptor;
  try {
    getDescriptor = new MethodDescription.ForLoadedMethod(clz.getDeclaredMethod("getDescriptor"));
  } catch (NoSuchMethodException e) {
    throw new IllegalStateException("Not an enum class: " + clz, e);
  }
  return MethodInvocation.invoke(getDescriptor);
}
 
开发者ID:curioswitch,项目名称:curiostack,代码行数:15,代码来源:CodeGenUtil.java

示例3: getExtraContextFactoryMethodDescription

import net.bytebuddy.description.method.MethodDescription; //导入方法依赖的package包/类
/**
 * This wrapper exists to convert checked exceptions to unchecked exceptions, since if this fails
 * the library itself is malformed.
 */
private static MethodDescription getExtraContextFactoryMethodDescription(
    String methodName, Class<?>... parameterTypes) {
  try {
    return new MethodDescription.ForLoadedMethod(
        DoFnInvoker.ArgumentProvider.class.getMethod(methodName, parameterTypes));
  } catch (Exception e) {
    throw new IllegalStateException(
        String.format(
            "Failed to locate required method %s.%s",
            DoFnInvoker.ArgumentProvider.class.getSimpleName(), methodName),
        e);
  }
}
 
开发者ID:apache,项目名称:beam,代码行数:18,代码来源:ByteBuddyDoFnInvokerFactory.java

示例4: DoFnMethodDelegation

import net.bytebuddy.description.method.MethodDescription; //导入方法依赖的package包/类
public DoFnMethodDelegation(TypeDescription doFnType, Method targetMethod) {
  this.doFnType = doFnType;
  this.targetMethod = new MethodDescription.ForLoadedMethod(targetMethod);
  targetHasReturn = !TypeDescription.VOID.equals(this.targetMethod.getReturnType().asErasure());
}
 
开发者ID:apache,项目名称:beam,代码行数:6,代码来源:ByteBuddyDoFnInvokerFactory.java


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