private static final Character coerceToCharacter(final Object obj) throws ELException { if (obj == null || "".equals(obj)) { return Character.valueOf((char) 0); } if (obj instanceof String) { return Character.valueOf(((String) obj).charAt(0)); } if (ELArithmetic.isNumber(obj)) { return Character.valueOf((char) ((Number) obj).shortValue()); } Class<?> objType = obj.getClass(); if (obj instanceof Character) { return (Character) obj; } throw new ELException(MessageFactory.get("error.convert", obj, objType, Character.class)); }
public static final Character coerceToCharacter(final Object obj) throws ELException { if (obj == null || "".equals(obj)) { return Character.valueOf((char) 0); } if (obj instanceof String) { return Character.valueOf(((String) obj).charAt(0)); } if (ELArithmetic.isNumber(obj)) { return Character.valueOf((char) ((Number) obj).shortValue()); } Class<?> objType = obj.getClass(); if (obj instanceof Character) { return (Character) obj; } throw new ELException(MessageFactory.get("error.convert", obj, objType, Character.class)); }
public final static Character coerceToCharacter(final Object obj) throws ELException { if (obj == null || "".equals(obj)) { return new Character((char) 0); } if (obj instanceof String) { return new Character(((String) obj).charAt(0)); } if (ELArithmetic.isNumber(obj)) { return new Character((char) ((Number) obj).shortValue()); } Class<?> objType = obj.getClass(); if (obj instanceof Character) { return (Character) obj; } throw new ELException(MessageFactory.get("error.convert", obj, objType, Character.class)); }
public static final Character coerceToCharacter(final Object obj) throws ELException { if (obj == null || "".equals(obj)) { return Character.valueOf((char) 0); } if (obj instanceof String) { return Character.valueOf(((String) obj).charAt(0)); } if (ELArithmetic.isNumber(obj)) { return Character.valueOf((char) ((Number) obj).shortValue()); } Class<?> objType = obj.getClass(); if (obj instanceof Character) { return (Character) obj; } throw new ELException(MESSAGES.errorConverting(obj, objType, Character.class)); }
public static final Character coerceToCharacter(final Object obj) throws ELException { if (obj == null || "".equals(obj)) { return Character.valueOf((char) 0); } if (obj instanceof String) { return Character.valueOf(((String) obj).charAt(0)); } if (ELArithmetic.isNumber(obj)) { return Character.valueOf((char) ((Number) obj).shortValue()); } Class<?> objType = obj.getClass(); if (obj instanceof Character) { return (Character) obj; } throw new ELException(MessageFactory.get("error.convert", obj, objType, Character.class)); }
protected final Number coerce(final Object obj) { if (isNumber(obj)) { return coerce((Number) obj); } if (obj == null || "".equals(obj)) { return coerce(ZERO); } if (obj instanceof String) { return coerce((String) obj); } if (obj instanceof Character) { return coerce(Short.valueOf((short) ((Character) obj).charValue())); } throw new IllegalArgumentException(MessageFactory.get("error.convert", obj, obj.getClass(), "Number")); }
protected final Number coerce(final Object obj) { if (isNumber(obj)) { return coerce((Number) obj); } if (obj instanceof String) { return coerce((String) obj); } if (obj == null || "".equals(obj)) { return coerce(ZERO); } if (obj instanceof Character) { return coerce(new Short((short) ((Character) obj).charValue())); } throw new IllegalArgumentException(MessageFactory.get("error.convert", obj, obj.getClass(), "Number")); }
protected final Number coerce(final Object obj) { if (isNumber(obj)) { return coerce((Number) obj); } if (obj == null || "".equals(obj)) { return coerce(ZERO); } if (obj instanceof String) { return coerce((String) obj); } if (obj instanceof Character) { return coerce(Short.valueOf((short) ((Character) obj).charValue())); } throw new IllegalArgumentException(MessageFactory.get("error.convert", obj, obj.getClass(), "Number")); }
protected final Number coerce(final Object obj) { if (isNumber(obj)) { return coerce((Number) obj); } if (obj instanceof String) { return coerce((String) obj); } if (obj == null || "".equals(obj)) { return coerce(ZERO); } if (obj instanceof Character) { return coerce(Short.valueOf((short) ((Character) obj).charValue())); } throw new IllegalArgumentException(MessageFactory.get("error.convert", obj, obj.getClass(), "Number")); }
protected final Number coerce(final Object obj) { if (isNumber(obj)) { return coerce((Number) obj); } if (obj == null || "".equals(obj)) { return coerce(ZERO); } if (obj instanceof String) { return coerce((String) obj); } if (obj instanceof Character) { return coerce(Short.valueOf((short) ((Character) obj).charValue())); } throw new IllegalArgumentException(MessageFactory.get("error.convert", obj, obj.getClass(), "Number")); }
protected final Number coerce(final Object obj) { if (isNumber(obj)) { return coerce((Number) obj); } if (obj == null || "".equals(obj)) { return coerce(ZERO); } if (obj instanceof String) { return coerce((String) obj); } if (obj instanceof Character) { return coerce(Short.valueOf((short) ((Character) obj).charValue())); } throw MESSAGES.errorConvertingWithException(obj, obj.getClass(), "Number"); }
private static final Character coerceToCharacter(final ELContext ctx, final Object obj) throws ELException { if (ctx != null) { boolean originalIsPropertyResolved = ctx.isPropertyResolved(); try { Object result = ctx.getELResolver().convertToType(ctx, obj, Character.class); if (ctx.isPropertyResolved()) { return (Character) result; } } finally { ctx.setPropertyResolved(originalIsPropertyResolved); } } if (obj == null || "".equals(obj)) { return Character.valueOf((char) 0); } if (obj instanceof String) { return Character.valueOf(((String) obj).charAt(0)); } if (ELArithmetic.isNumber(obj)) { return Character.valueOf((char) ((Number) obj).shortValue()); } Class<?> objType = obj.getClass(); if (obj instanceof Character) { return (Character) obj; } throw new ELException(MessageFactory.get("error.convert", obj, objType, Character.class)); }
public static final Number coerceToNumber(final Object obj, final Class<?> type) throws ELException { if (obj == null || "".equals(obj)) { return coerceToNumber(ZERO, type); } if (obj instanceof String) { return coerceToNumber((String) obj, type); } if (ELArithmetic.isNumber(obj)) { return coerceToNumber((Number) obj, type); } if (obj instanceof Character) { return coerceToNumber(Short.valueOf((short) ((Character) obj) .charValue()), type); } throw new ELException(MESSAGES.errorConverting(obj, obj.getClass(), type)); }
public static final Number coerceToNumber(final Object obj, final Class<?> type) throws ELException { if (obj == null || "".equals(obj)) { return coerceToNumber(ZERO, type); } if (obj instanceof String) { return coerceToNumber((String) obj, type); } if (ELArithmetic.isNumber(obj)) { return coerceToNumber((Number) obj, type); } if (obj instanceof Character) { return coerceToNumber(Short.valueOf((short) ((Character) obj) .charValue()), type); } throw new ELException(MessageFactory.get("error.convert", obj, obj.getClass(), type)); }
public final static Number coerceToNumber(final Object obj, final Class<?> type) throws ELException { if (obj == null || "".equals(obj)) { return coerceToNumber(ZERO, type); } if (obj instanceof String) { return coerceToNumber((String) obj, type); } if (ELArithmetic.isNumber(obj)) { return coerceToNumber((Number) obj, type); } if (obj instanceof Character) { return coerceToNumber(new Short((short) ((Character) obj) .charValue()), type); } throw new ELException(MessageFactory.get("error.convert", obj, obj.getClass(), type)); }
public static final Number coerceToNumber(final Object obj, final Class<?> type) throws ELException { if (obj == null || "".equals(obj)) { return coerceToNumber(ZERO, type); } if (obj instanceof String) { return coerceToNumber((String) obj, type); } if (ELArithmetic.isNumber(obj)) { return coerceToNumber((Number) obj, type); } if (obj instanceof Character) { return coerceToNumber(Short.valueOf((short) ((Character) obj) .charValue()), type); } throw new ELException(MessageFactory.get("error.convert", obj, obj.getClass(), type)); }
public static final Number coerceToNumber(final Object obj, final Class<?> type) throws ELException { if (!COERCE_TO_ZERO) { if (obj == null && !type.isPrimitive()) { return null; } } if (obj == null || "".equals(obj)) { return coerceToNumber(ZERO, type); } if (obj instanceof String) { return coerceToNumber((String) obj, type); } if (ELArithmetic.isNumber(obj)) { return coerceToNumber((Number) obj, type); } if (obj instanceof Character) { return coerceToNumber(Short.valueOf((short) ((Character) obj) .charValue()), type); } throw new ELException(MessageFactory.get("error.convert", obj, obj.getClass(), type)); }
return coerceToNumber((String) obj, type); if (ELArithmetic.isNumber(obj)) { return coerceToNumber((Number) obj, type);