/** * Retrieve a JDBC column value from a ResultSet, using the most appropriate * value type. The returned value should be a detached value object, not * having any ties to the active ResultSet: in particular, it should not be * a Blob or Clob object but rather a byte array respectively String * representation. * <p> * Uses the <code>getObject(index)</code> method, but includes additional * "hacks" to get around Oracle 10g returning a non-standard object for its * TIMESTAMP datatype and a <code>java.sql.Date</code> for DATE columns * leaving out the time portion: These columns will explicitly be extracted * as standard <code>java.sql.Timestamp</code> object. * * @param rs is the ResultSet holding the data * @param index is the column index * @return the value object * @throws SQLException if thrown by the JDBC API * @see Blob * @see Clob * @see Timestamp */ private static String getResultSetValue(ResultSet rs, int index) throws SQLException { Object obj = rs.getObject(index); return (obj == null) ? null : convertUtilsBean.convert(obj); }
/** * <p>Convert the value to an object of the specified class (if * possible).</p> * * @param value Value to be converted (may be null) * @param type Class of the value to be converted to * @return The converted value */ @Override protected Object convert(final Object value, final Class<?> type) { return getConvertUtils().convert(value, type); } }
/** * <p>Convert the specified value into a String.</p> * * <p>For more details see <code>ConvertUtilsBean</code>.</p> * * @param value Value to be converted (may be null) * @return The converted String value or null if value is null * * @see ConvertUtilsBean#convert(Object) */ public static String convert(final Object value) { return ConvertUtilsBean.getInstance().convert(value); }
/** * <p>Convert the value to an object of the specified class (if * possible).</p> * * @param value Value to be converted (may be null) * @param targetType Class of the value to be converted to (must not be null) * @return The converted value * * @throws ConversionException if thrown by an underlying Converter */ public static Object convert(final Object value, final Class<?> targetType) { return ConvertUtilsBean.getInstance().convert(value, targetType); }
/** * <p>Convert the value to an object of the specified class (if * possible).</p> * * @param value Value to be converted (may be null) * @param targetType Class of the value to be converted to (must not be null) * @return The converted value * * @throws ConversionException if thrown by an underlying Converter */ public static Object convert(final Object value, final Class<?> targetType) { return ConvertUtilsBean.getInstance().convert(value, targetType); }
/** * <p>Convert the value to an object of the specified class (if * possible).</p> * * @param value Value to be converted (may be null) * @param type Class of the value to be converted to * @return The converted value */ @Override protected Object convert(final Object value, final Class<?> type) { return getConvertUtils().convert(value, type); } }
/** * <p>Convert the specified value into a String.</p> * * <p>For more details see <code>ConvertUtilsBean</code>.</p> * * @param value Value to be converted (may be null) * @return The converted String value or null if value is null * * @see ConvertUtilsBean#convert(Object) */ public static String convert(final Object value) { return ConvertUtilsBean.getInstance().convert(value); }
/** * <p>Convert the specified value to an object of the specified class (if * possible). Otherwise, return a String representation of the value.</p> * * <p>For more details see <code>ConvertUtilsBean</code>.</p> * * @param value Value to be converted (may be null) * @param clazz Java class to be converted to (must not be null) * @return The converted value * * @see ConvertUtilsBean#convert(String, Class) */ public static Object convert(final String value, final Class<?> clazz) { return ConvertUtilsBean.getInstance().convert(value, clazz); }
/** * <p>Convert an array of specified values to an array of objects of the * specified class (if possible).</p> * * <p>For more details see <code>ConvertUtilsBean</code>.</p> * * @param values Array of values to be converted * @param clazz Java array or element class to be converted to (must not be null) * @return The converted value * * @see ConvertUtilsBean#convert(String[], Class) */ public static Object convert(final String[] values, final Class<?> clazz) { return ConvertUtilsBean.getInstance().convert(values, clazz); }
/** * <p>Convert an array of specified values to an array of objects of the * specified class (if possible).</p> * * <p>For more details see <code>ConvertUtilsBean</code>.</p> * * @param values Array of values to be converted * @param clazz Java array or element class to be converted to (must not be null) * @return The converted value * * @see ConvertUtilsBean#convert(String[], Class) */ public static Object convert(final String[] values, final Class<?> clazz) { return ConvertUtilsBean.getInstance().convert(values, clazz); }
/** * <p>Convert the specified value to an object of the specified class (if * possible). Otherwise, return a String representation of the value.</p> * * <p>For more details see <code>ConvertUtilsBean</code>.</p> * * @param value Value to be converted (may be null) * @param clazz Java class to be converted to (must not be null) * @return The converted value * * @see ConvertUtilsBean#convert(String, Class) */ public static Object convert(final String value, final Class<?> clazz) { return ConvertUtilsBean.getInstance().convert(value, clazz); }
/** * Return the value of the specified simple property of the specified * bean, converted to a String. * * @param bean Bean whose property is to be extracted * @param name Name of the property to be extracted * @return The property's value, converted to a String * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * property cannot be found */ public String getSimpleProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { final Object value = getPropertyUtils().getSimpleProperty(bean, name); return (getConvertUtils().convert(value)); }
/** * Return the value of the specified simple property of the specified * bean, converted to a String. * * @param bean Bean whose property is to be extracted * @param name Name of the property to be extracted * @return The property's value, converted to a String * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * property cannot be found */ public String getSimpleProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { final Object value = getPropertyUtils().getSimpleProperty(bean, name); return (getConvertUtils().convert(value)); }
/** * Return the value of the specified mapped property of the specified * bean, as a String. The key is specified as a method parameter and * must *not* be included in the property name expression * * @param bean Bean whose property is to be extracted * @param name Simple property name of the property value to be extracted * @param key Lookup key of the property value to be extracted * @return The mapped property's value, converted to a String * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * property cannot be found */ public String getMappedProperty(final Object bean, final String name, final String key) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { final Object value = getPropertyUtils().getMappedProperty(bean, name, key); return (getConvertUtils().convert(value)); }
/** * Return the value of the specified indexed property of the specified * bean, as a String. The String-valued key of the required value * must be included (in parentheses) as a suffix to * the property name, or <code>IllegalArgumentException</code> will be * thrown. * * @param bean Bean whose property is to be extracted * @param name <code>propertyname(index)</code> of the property value * to be extracted * @return The mapped property's value, converted to a String * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * property cannot be found */ public String getMappedProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { final Object value = getPropertyUtils().getMappedProperty(bean, name); return (getConvertUtils().convert(value)); }
/** * Return the value of the (possibly nested) property of the specified * name, for the specified bean, as a String. * * @param bean Bean whose property is to be extracted * @param name Possibly nested name of the property to be extracted * @return The nested property's value, converted to a String * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws IllegalArgumentException if a nested reference to a * property returns null * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * property cannot be found */ public String getNestedProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { final Object value = getPropertyUtils().getNestedProperty(bean, name); return (getConvertUtils().convert(value)); }
/** * Return the value of the (possibly nested) property of the specified * name, for the specified bean, as a String. * * @param bean Bean whose property is to be extracted * @param name Possibly nested name of the property to be extracted * @return The nested property's value, converted to a String * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws IllegalArgumentException if a nested reference to a * property returns null * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * property cannot be found */ public String getNestedProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { final Object value = getPropertyUtils().getNestedProperty(bean, name); return (getConvertUtils().convert(value)); }
/** * Return the value of the specified indexed property of the specified * bean, as a String. The zero-relative index of the * required value must be included (in square brackets) as a suffix to * the property name, or <code>IllegalArgumentException</code> will be * thrown. * * @param bean Bean whose property is to be extracted * @param name <code>propertyname[index]</code> of the property value * to be extracted * @return The indexed property's value, converted to a String * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * property cannot be found */ public String getIndexedProperty(final Object bean, final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { final Object value = getPropertyUtils().getIndexedProperty(bean, name); return (getConvertUtils().convert(value)); }
/** * Return the value of the specified indexed property of the specified * bean, as a String. The index is specified as a method parameter and * must *not* be included in the property name expression * * @param bean Bean whose property is to be extracted * @param name Simple property name of the property value to be extracted * @param index Index of the property value to be extracted * @return The indexed property's value, converted to a String * * @throws IllegalAccessException if the caller does not have * access to the property accessor method * @throws InvocationTargetException if the property accessor method * throws an exception * @throws NoSuchMethodException if an accessor method for this * property cannot be found */ public String getIndexedProperty(final Object bean, final String name, final int index) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { final Object value = getPropertyUtils().getIndexedProperty(bean, name, index); return (getConvertUtils().convert(value)); }