@Test public void testMatchesType() { assertThat(ReflectionUtil.matchesType(int.class, int.class)).isEqualTo(true); assertThat(ReflectionUtil.matchesType(Integer.class, Integer.class)).isEqualTo(true); assertThat(ReflectionUtil.matchesType(int.class, Integer.class)).isEqualTo(true); assertThat(ReflectionUtil.matchesType(long.class, Long.class)).isEqualTo(true); assertThat(ReflectionUtil.matchesType(short.class, Short.class)).isEqualTo(true); assertThat(ReflectionUtil.matchesType(byte.class, Byte.class)).isEqualTo(true); assertThat(ReflectionUtil.matchesType(boolean.class, Boolean.class)).isEqualTo(true); assertThat(ReflectionUtil.matchesType(float.class, Float.class)).isEqualTo(true); assertThat(ReflectionUtil.matchesType(double.class, Double.class)).isEqualTo(true); assertThat(ReflectionUtil.matchesType(char.class, Character.class)).isEqualTo(true); assertThat(ReflectionUtil.matchesType(Object.class, Integer.class)).isEqualTo(true); assertThat(ReflectionUtil.matchesType(int.class, boolean.class)).isEqualTo(false); assertThat(ReflectionUtil.matchesType(Integer.class, String.class)).isEqualTo(false); }
public static boolean matchesType(Class<?> parameterType, Class<?> argumentType) { if ((parameterType == int.class && argumentType == Integer.class) || (parameterType == long.class && argumentType == Long.class) || (parameterType == short.class && argumentType == Short.class) || (parameterType == byte.class && argumentType == Byte.class) || (parameterType == boolean.class && argumentType == Boolean.class) || (parameterType == float.class && argumentType == Float.class) || (parameterType == double.class && argumentType == Double.class) || (parameterType == char.class && argumentType == Character.class)) { return true; } return parameterType.isAssignableFrom(argumentType); }
ReflectionUtil { public static boolean matchesType(Class<?> parameterType, Class<?> argumentType) { if ((parameterType == int.class && argumentType == Integer.class) || (parameterType == long.class && argumentType == Long.class) || (parameterType == short.class && argumentType == Short.class) || (parameterType == byte.class && argumentType == Byte.class) || (parameterType == boolean.class && argumentType == Boolean.class) || (parameterType == float.class && argumentType == Float.class) || (parameterType == double.class && argumentType == Double.class) || (parameterType == char.class && argumentType == Character.class)) { return true; } return parameterType.isAssignableFrom(argumentType); } }
ReflectionUtil { public static boolean matchesType(Class<?> parameterType, Class<?> argumentType) { if ((parameterType == int.class && argumentType == Integer.class) || (parameterType == long.class && argumentType == Long.class) || (parameterType == short.class && argumentType == Short.class) || (parameterType == byte.class && argumentType == Byte.class) || (parameterType == boolean.class && argumentType == Boolean.class) || (parameterType == float.class && argumentType == Float.class) || (parameterType == double.class && argumentType == Double.class) || (parameterType == char.class && argumentType == Character.class)) { return true; } return parameterType.isAssignableFrom(argumentType); } private  ReflectionUtil(); }
ReflectionUtil { public static boolean matchesType(Class<?> parameterType, Class<?> argumentType) { if ((parameterType == int.class && argumentType == Integer.class) || (parameterType == long.class && argumentType == Long.class) || (parameterType == short.class && argumentType == Short.class) || (parameterType == byte.class && argumentType == Byte.class) || (parameterType == boolean.class && argumentType == Boolean.class) || (parameterType == float.class && argumentType == Float.class) || (parameterType == double.class && argumentType == Double.class) || (parameterType == char.class && argumentType == Character.class)) { return true; } return parameterType.isAssignableFrom(argumentType); } private  ReflectionUtil(); static boolean matchesArguments(Constructor<?> constructor, Object[] arguments); static boolean matchesArguments(Method method, Object[] arguments); static boolean matchesArguments(Class<?>[] argumentTypes, Object[] arguments); static boolean matchesType(Class<?> parameterType, Class<?> argumentType); }
ReflectionUtil { public static boolean matchesType(Class<?> parameterType, Class<?> argumentType) { if ((parameterType == int.class && argumentType == Integer.class) || (parameterType == long.class && argumentType == Long.class) || (parameterType == short.class && argumentType == Short.class) || (parameterType == byte.class && argumentType == Byte.class) || (parameterType == boolean.class && argumentType == Boolean.class) || (parameterType == float.class && argumentType == Float.class) || (parameterType == double.class && argumentType == Double.class) || (parameterType == char.class && argumentType == Character.class)) { return true; } return parameterType.isAssignableFrom(argumentType); } private  ReflectionUtil(); static boolean matchesArguments(Constructor<?> constructor, Object[] arguments); static boolean matchesArguments(Method method, Object[] arguments); static boolean matchesArguments(Class<?>[] argumentTypes, Object[] arguments); static boolean matchesType(Class<?> parameterType, Class<?> argumentType);  }