MCPcopy Create free account
hub / github.com/boxbeam/RedLib / getArgTypes

Method getArgTypes

src/redempt/redlib/nms/NMSHelper.java:66–97  ·  view source on GitHub ↗

Gets the class list of argument types for finding methods @param args The arguments to convert to their class types @return The class types of each argument

(Object... args)

Source from the content-addressed store, hash-verified

64 * @return The class types of each argument
65 */
66 public static Class<?>[] getArgTypes(Object... args) {
67 unwrapArgs(args);
68 Class<?>[] classes = new Class<?>[args.length];
69 for (int i = 0; i < args.length; i++) {
70 if (args[i] instanceof NMSObject) {
71 classes[i] = ((NMSObject) args[i]).getObject().getClass();
72 continue;
73 }
74 classes[i] = args[i].getClass();
75 switch (classes[i].getSimpleName()) {
76 case "Integer":
77 classes[i] = int.class;
78 break;
79 case "Boolean":
80 classes[i] = boolean.class;
81 break;
82 case "Float":
83 classes[i] = float.class;
84 break;
85 case "Double":
86 classes[i] = double.class;
87 break;
88 case "Long":
89 classes[i] = long.class;
90 break;
91 case "Short":
92 classes[i] = short.class;
93 break;
94 }
95 }
96 return classes;
97 }
98
99 /**
100 * Gets a method by its name and parameter types, accounts for cases where the given class might not be the

Callers 3

getInstanceMethod · 0.95
callStaticMethodMethod · 0.95
callMethodMethod · 0.95

Calls 3

unwrapArgsMethod · 0.95
getClassMethod · 0.80
getObjectMethod · 0.45

Tested by

no test coverage detected