|| obj1 instanceof Double
|| obj0 instanceof Float
|| obj1 instanceof Float
- || (obj0 != null && (Double.TYPE == obj0.getClass() || Float.TYPE == obj0.getClass()))
- || (obj1 != null && (Double.TYPE == obj1.getClass() || Float.TYPE == obj1.getClass()))
|| (obj0 instanceof String && ELSupport
.isStringFloat((String) obj0)) || (obj1 instanceof String && ELSupport
.isStringFloat((String) obj1)));
return coerce(ZERO);
}
- Class objType = obj.getClass();
- if (Character.class.equals(objType) || Character.TYPE == objType) {
+ if (obj instanceof Character) {
return coerce(new Short((short) ((Character) obj).charValue()));
}
throw new IllegalArgumentException(MessageFactory.get("error.convert",
- obj, objType, "Number"));
+ obj, obj.getClass(), "Number"));
}
protected abstract Number coerce(final String str);
if (obj == null || "".equals(obj)) {
return Boolean.FALSE;
}
- if (obj instanceof Boolean || obj.getClass() == Boolean.TYPE) {
+ if (obj instanceof Boolean) {
return (Boolean) obj;
}
if (obj instanceof String) {
return new Character((char) ((Number) obj).shortValue());
}
Class objType = obj.getClass();
- if (obj instanceof Character || objType == Character.TYPE) {
+ if (obj instanceof Character) {
return (Character) obj;
}
return coerceToNumber((Number) obj, type);
}
- Class objType = obj.getClass();
- if (Character.class.equals(objType) || Character.TYPE == objType) {
+ if (obj instanceof Character) {
return coerceToNumber(new Short((short) ((Character) obj)
.charValue()), type);
}
throw new IllegalArgumentException(MessageFactory.get("error.convert",
- obj, objType, type));
+ obj, obj.getClass(), type));
}
protected final static Number coerceToNumber(final String val,
return (obj0 instanceof Double
|| obj1 instanceof Double
|| obj0 instanceof Float
- || obj1 instanceof Float
- || (obj0 != null && (Double.TYPE == obj0.getClass() || Float.TYPE == obj0
- .getClass())) || (obj1 != null && (Double.TYPE == obj1
- .getClass() || Float.TYPE == obj1.getClass())));
+ || obj1 instanceof Float);
}
public final static boolean isDoubleStringOp(final Object obj0,
|| obj0 instanceof Short
|| obj1 instanceof Short
|| obj0 instanceof Byte
- || obj1 instanceof Byte
- || (obj0 != null && (Long.TYPE == obj0.getClass()
- || Integer.TYPE == obj0.getClass()
- || Character.TYPE == obj0.getClass()
- || Short.TYPE == obj0.getClass() || Byte.TYPE == obj0
- .getClass())) || (obj0 != null && (Long.TYPE == obj0
- .getClass()
- || Integer.TYPE == obj0.getClass()
- || Character.TYPE == obj0.getClass()
- || Short.TYPE == obj0.getClass() || Byte.TYPE == obj0
- .getClass())));
+ || obj1 instanceof Byte);
}
public final static boolean isStringFloat(final String str) {
}
return new Long(-Long.parseLong((String) obj));
}
- Class type = obj.getClass();
- if (obj instanceof Long || Long.TYPE == type) {
+ if (obj instanceof Long) {
return new Long(-((Long) obj).longValue());
}
- if (obj instanceof Double || Double.TYPE == type) {
+ if (obj instanceof Double) {
return new Double(-((Double) obj).doubleValue());
}
- if (obj instanceof Integer || Integer.TYPE == type) {
+ if (obj instanceof Integer) {
return new Integer(-((Integer) obj).intValue());
}
- if (obj instanceof Float || Float.TYPE == type) {
+ if (obj instanceof Float) {
return new Float(-((Float) obj).floatValue());
}
- if (obj instanceof Short || Short.TYPE == type) {
+ if (obj instanceof Short) {
return new Short((short) -((Short) obj).shortValue());
}
- if (obj instanceof Byte || Byte.TYPE == type) {
+ if (obj instanceof Byte) {
return new Byte((byte) -((Byte) obj).byteValue());
}
Long num = (Long) coerceToNumber(obj, Long.class);