MCPcopy Index your code
hub / github.com/clojure/clojure / Method

Class Method

src/jvm/clojure/asm/commons/Method.java:42–263  ·  view source on GitHub ↗

A named method descriptor. @author Juozas Baliuka @author Chris Nokleberg @author Eric Bruneton

Source from the content-addressed store, hash-verified

40 * @author Eric Bruneton
41 */
42public class Method {
43
44 /** The method name. */
45 private final String name;
46
47 /** The method descriptor. */
48 private final String descriptor;
49
50 /** The descriptors of the primitive Java types (plus void). */
51 private static final Map<String, String> PRIMITIVE_TYPE_DESCRIPTORS;
52
53 static {
54 HashMap<String, String> descriptors = new HashMap<String, String>();
55 descriptors.put("void", "V");
56 descriptors.put("byte", "B");
57 descriptors.put("char", "C");
58 descriptors.put("double", "D");
59 descriptors.put("float", "F");
60 descriptors.put("int", "I");
61 descriptors.put("long", "J");
62 descriptors.put("short", "S");
63 descriptors.put("boolean", "Z");
64 PRIMITIVE_TYPE_DESCRIPTORS = descriptors;
65 }
66
67 /**
68 * Constructs a new {@link Method}.
69 *
70 * @param name the method's name.
71 * @param descriptor the method's descriptor.
72 */
73 public Method(final String name, final String descriptor) {
74 this.name = name;
75 this.descriptor = descriptor;
76 }
77
78 /**
79 * Constructs a new {@link Method}.
80 *
81 * @param name the method's name.
82 * @param returnType the method's return type.
83 * @param argumentTypes the method's argument types.
84 */
85 public Method(final String name, final Type returnType, final Type[] argumentTypes) {
86 this(name, Type.getMethodDescriptor(returnType, argumentTypes));
87 }
88
89 /**
90 * Creates a new {@link Method}.
91 *
92 * @param method a java.lang.reflect method descriptor
93 * @return a {@link Method} corresponding to the given Java method declaration.
94 */
95 public static Method getMethod(final java.lang.reflect.Method method) {
96 return new Method(method.getName(), Type.getMethodDescriptor(method));
97 }
98
99 /**

Callers

nothing calls this directly

Calls 1

putMethod · 0.45

Tested by

no test coverage detected