org.springframework.asm.Type.getMethodDescriptor()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.springframework.asm.Type.getMethodDescriptor()方法的一些代码示例,展示了Type.getMethodDescriptor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Type.getMethodDescriptor()方法的具体详情如下:
包路径:org.springframework.asm.Type
类名称:Type
方法名:getMethodDescriptor

Type.getMethodDescriptor介绍

[英]Returns the descriptor corresponding to the given method.
[中]返回与给定方法对应的描述符。

代码示例

代码示例来源:origin: spring-projects/spring-framework

public static Method[] findMethods(String[] namesAndDescriptors, Method[] methods) {
  Map map = new HashMap();
  for (int i = 0; i < methods.length; i++) {
    Method method = methods[i];
    map.put(method.getName() + Type.getMethodDescriptor(method), method);
  }
  Method[] result = new Method[namesAndDescriptors.length / 2];
  for (int i = 0; i < result.length; i++) {
    result[i] = (Method) map.get(namesAndDescriptors[i * 2] + namesAndDescriptors[i * 2 + 1]);
    if (result[i] == null) {
      // TODO: error?
    }
  }
  return result;
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Returns the method {@link Type} corresponding to the given argument and return types.
 *
 * @param returnType the return type of the method.
 * @param argumentTypes the argument types of the method.
 * @return the method {@link Type} corresponding to the given argument and return types.
 */
public static Type getMethodType(final Type returnType, final Type... argumentTypes) {
 return getType(getMethodDescriptor(returnType, argumentTypes));
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Returns the method {@link Type} corresponding to the given method.
 *
 * @param method a {@link Method} object.
 * @return the method {@link Type} corresponding to the given method.
 */
public static Type getType(final Method method) {
 return getType(getMethodDescriptor(method));
}

代码示例来源:origin: spring-projects/spring-framework

public static Signature getSignature(Member member) {
  if (member instanceof Method) {
    return new Signature(member.getName(), Type.getMethodDescriptor((Method) member));
  }
  else if (member instanceof Constructor) {
    Type[] types = TypeUtils.getTypes(((Constructor) member).getParameterTypes());
    return new Signature(Constants.CONSTRUCTOR_NAME,
        Type.getMethodDescriptor(Type.VOID_TYPE, types));
  }
  else {
    throw new IllegalArgumentException("Cannot get signature of a field");
  }
}

代码示例来源:origin: org.springframework/spring-core

public static Method[] findMethods(String[] namesAndDescriptors, Method[] methods) {
  Map map = new HashMap();
  for (int i = 0; i < methods.length; i++) {
    Method method = methods[i];
    map.put(method.getName() + Type.getMethodDescriptor(method), method);
  }
  Method[] result = new Method[namesAndDescriptors.length / 2];
  for (int i = 0; i < result.length; i++) {
    result[i] = (Method) map.get(namesAndDescriptors[i * 2] + namesAndDescriptors[i * 2 + 1]);
    if (result[i] == null) {
      // TODO: error?
    }
  }
  return result;
}

代码示例来源:origin: org.springframework/spring-core

/**
 * Returns the method {@link Type} corresponding to the given method.
 *
 * @param method a {@link Method} object.
 * @return the method {@link Type} corresponding to the given method.
 */
public static Type getType(final Method method) {
 return getType(getMethodDescriptor(method));
}

代码示例来源:origin: org.springframework/spring-core

/**
 * Returns the method {@link Type} corresponding to the given argument and return types.
 *
 * @param returnType the return type of the method.
 * @param argumentTypes the argument types of the method.
 * @return the method {@link Type} corresponding to the given argument and return types.
 */
public static Type getMethodType(final Type returnType, final Type... argumentTypes) {
 return getType(getMethodDescriptor(returnType, argumentTypes));
}

代码示例来源:origin: alibaba/jetcache

public static String getKey(Method method, Class targetClass) {
  StringBuilder sb = new StringBuilder();
  sb.append(method.getDeclaringClass().getName());
  sb.append('.');
  sb.append(method.getName());
  sb.append(Type.getMethodDescriptor(method));
  if (targetClass != null) {
    sb.append('_');
    sb.append(targetClass.getName());
  }
  return sb.toString();
}

代码示例来源:origin: org.springframework/spring-core

public static Signature getSignature(Member member) {
  if (member instanceof Method) {
    return new Signature(member.getName(), Type.getMethodDescriptor((Method) member));
  }
  else if (member instanceof Constructor) {
    Type[] types = TypeUtils.getTypes(((Constructor) member).getParameterTypes());
    return new Signature(Constants.CONSTRUCTOR_NAME,
        Type.getMethodDescriptor(Type.VOID_TYPE, types));
  }
  else {
    throw new IllegalArgumentException("Cannot get signature of a field");
  }
}

代码示例来源:origin: org.springframework.boot/spring-boot-actuator

public HandlerMethodDescription(HandlerMethod handlerMethod) {
  this.name = handlerMethod.getMethod().getName();
  this.className = handlerMethod.getMethod().getDeclaringClass().getCanonicalName();
  this.descriptor = Type.getMethodDescriptor(handlerMethod.getMethod());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core

public static Method[] findMethods(String[] namesAndDescriptors, Method[] methods) {
  Map map = new HashMap();
  for (int i = 0; i < methods.length; i++) {
    Method method = methods[i];
    map.put(method.getName() + Type.getMethodDescriptor(method), method);
  }
  Method[] result = new Method[namesAndDescriptors.length / 2];
  for (int i = 0; i < result.length; i++) {
    result[i] = (Method) map.get(namesAndDescriptors[i * 2] + namesAndDescriptors[i * 2 + 1]);
    if (result[i] == null) {
      // TODO: error?
    }
  }
  return result;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core

/**
 * Returns the method {@link Type} corresponding to the given argument and return types.
 *
 * @param returnType the return type of the method.
 * @param argumentTypes the argument types of the method.
 * @return the method {@link Type} corresponding to the given argument and return types.
 */
public static Type getMethodType(final Type returnType, final Type... argumentTypes) {
 return getType(getMethodDescriptor(returnType, argumentTypes));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core

/**
 * Returns the method {@link Type} corresponding to the given method.
 *
 * @param method a {@link Method} object.
 * @return the method {@link Type} corresponding to the given method.
 */
public static Type getType(final Method method) {
 return getType(getMethodDescriptor(method));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core

public static Signature getSignature(Member member) {
  if (member instanceof Method) {
    return new Signature(member.getName(), Type.getMethodDescriptor((Method) member));
  }
  else if (member instanceof Constructor) {
    Type[] types = TypeUtils.getTypes(((Constructor) member).getParameterTypes());
    return new Signature(Constants.CONSTRUCTOR_NAME,
        Type.getMethodDescriptor(Type.VOID_TYPE, types));
  }
  else {
    throw new IllegalArgumentException("Cannot get signature of a field");
  }
}

代码示例来源:origin: org.springframework.data/spring-data-geode

fv.visitEnd();
String voidNoArgMethodDescriptor = Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] {});
mv.visitEnd();
String voidArgClassAndIntDescriptor = Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] {
    Type.getType(Class.class), Type.INT_TYPE });
String customTypeNoArgDesc = Type.getMethodDescriptor(customClassType, new Type[] {});

代码示例来源:origin: org.springframework.data/spring-data-gemfire

fv.visitEnd();
String voidNoArgMethodDescriptor = Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] {});
mv.visitEnd();
String voidArgClassAndIntDescriptor = Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] {
    Type.getType(Class.class), Type.INT_TYPE });
String customTypeNoArgDesc = Type.getMethodDescriptor(customClassType, new Type[] {});

相关文章