forked from SteamWar/SteamWar
Add Annotation Processor for compile time checks
This commit is contained in:
@@ -132,14 +132,14 @@ public class CommandUtils {
|
||||
return annotations;
|
||||
}
|
||||
|
||||
public static ToIntFunction<Number> createComparator(String type, Class<?> clazz, int iValue, long lValue, float fValue, double dValue) {
|
||||
if (clazz == int.class || clazz == Integer.class) {
|
||||
public static ToIntFunction<Number> createComparator(String type, Handler.TypeWrapper clazz, int iValue, long lValue, float fValue, double dValue) {
|
||||
if (clazz.is(int.class) || clazz.is(Integer.class)) {
|
||||
return number -> Integer.compare(number.intValue(), iValue);
|
||||
} else if (clazz == long.class || clazz == Long.class) {
|
||||
} else if (clazz.is(long.class) || clazz.is(Long.class)) {
|
||||
return number -> Long.compare(number.longValue(), lValue);
|
||||
} else if (clazz == float.class || clazz == Float.class) {
|
||||
} else if (clazz.is(float.class) || clazz.is(Float.class)) {
|
||||
return number -> Float.compare(number.floatValue(), fValue);
|
||||
} else if (clazz == double.class || clazz == Double.class) {
|
||||
} else if (clazz.is(double.class) || clazz.is(Double.class)) {
|
||||
return number -> Double.compare(number.doubleValue(), dValue);
|
||||
} else {
|
||||
throw new IllegalArgumentException(type + " annotation is not supported for " + clazz);
|
||||
|
||||
Reference in New Issue
Block a user