MCPcopy
hub / github.com/ccxt/ccxt / findCompatibleIn

Method findCompatibleIn

java/tests/src/main/java/tests/BaseTest.java:843–862  ·  view source on GitHub ↗
(Method[] methods, String name, List<Object> args)

Source from the content-addressed store, hash-verified

841 }
842
843 private static Method findCompatibleIn(Method[] methods, String name, List<Object> args) {
844 for (Method m : methods) {
845 if (!m.getName().equals(name)) continue;
846
847 Class<?>[] p = m.getParameterTypes();
848 if (p.length != args.size()) continue;
849
850 boolean ok = true;
851 for (int i = 0; i < p.length; i++) {
852 Object a = args.get(i);
853 if (a == null) continue;
854 if (!isAssignable(p[i], a.getClass())) {
855 ok = false;
856 break;
857 }
858 }
859 if (ok) return m;
860 }
861 return null;
862 }
863
864 private static boolean isAssignable(Class<?> paramType, Class<?> argType) {
865 if (paramType.isPrimitive()) paramType = boxPrimitive(paramType);

Callers 1

findCompatibleMethodMethod · 0.95

Calls 3

isAssignableMethod · 0.95
equalsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected