public Object convertValue(Map<String, Object> context, Object value, Class toType) { return convertValue(value, toType); }
public Object convertValue(Map<String, Object> context, Object target, Member member, String propertyName, Object value, Class toType) { return convertValue(context, value, toType); }
/** * Converts the given object to a given type. How this is to be done is implemented in toClass. The OGNL context, o * and toClass are given. This method should be able to handle conversion in general without any context or object * specified. * * @param context - OGNL context under which the conversion is being done * @param o - the object to be converted * @param toClass - the class that contains the code to convert to enumeration * @return Converted value of type declared in toClass or TypeConverter.NoConversionPossible to indicate that the * conversion was not possible. */ @Override public Object convertValue(Map<String, Object> context, Object o, Class toClass) { if (o instanceof String[]) { return convertFromString(((String[]) o)[0], toClass); } else if (o instanceof String) { return convertFromString((String) o, toClass); } return super.convertValue(context, o, toClass); }
return new BigInteger((String) value); } else if (toType.isPrimitive()) { Object convertedValue = super.convertValue(context, value, toType); String stringValue = (String) value; if (!isInRange((Number) convertedValue, stringValue, toType)) throw new XWorkException("Overflow or underflow casting: \"" + stringValue + "\" into class " + number.getClass().getName()); value = super.convertValue(context, number, toType); return super.convertValue(context, value, toType);
.getLength(value)); for (int i = 0, icount = Array.getLength(value); i < icount; i++) { Array.set(result, i, convertValue(Array.get(value, i), componentType));
result = super.convertValue(context, value, toType);
if (LOG.isDebugEnabled()) LOG.debug("falling back to Ognl's default type conversion"); return super.convertValue(value, toClass); } catch (Exception e) { if (LOG.isDebugEnabled())