/** * Converts the supplied object to the supplied target type. * * @param value the object to be converted. * @param targetType the target type. * @return the converted object. */ public final Object convert(Object value, Type targetType) { if (targetType instanceof TypeVariable<?>) targetType = TypeUtil.getBoundType((TypeVariable<?>)targetType); return internalConvert(value, targetType); }
/** * Tells if the supplied object may be converted to the supplied target type by * this converter. * * @param value the object to be converted. * @param targetType the target type. * @return true if this converter can convert o to the target type, false otherwise. */ public final boolean canConvert(Object value, Type targetType) { if (targetType instanceof TypeVariable<?>) targetType = TypeUtil.getBoundType((TypeVariable<?>)targetType); return internalCanConvert(value, targetType); }
/** * Tells if the supplied object may be converted to the supplied target type by * this converter. * * @param value the object to be converted. * @param targetType the target type. * @return true if this converter can convert o to the target type, false otherwise. */ public final boolean canConvert(Object value, Type targetType) { if (targetType instanceof TypeVariable<?>) targetType = TypeUtil.getBoundType((TypeVariable<?>)targetType); return internalCanConvert(value, targetType); }
/** * Converts the supplied object to the supplied target type. * * @param value the object to be converted. * @param targetType the target type. * @return the converted object. */ public final Object convert(Object value, Type targetType) { if (targetType instanceof TypeVariable<?>) targetType = TypeUtil.getBoundType((TypeVariable<?>)targetType); return internalConvert(value, targetType); }
/** * Converts the supplied object to the supplied target type. * * @param value the object to be converted. * @param targetType the target type. * @return the converted object. */ public final Object convert(Object value, Type targetType) { if (targetType instanceof TypeVariable<?>) targetType = TypeUtil.getBoundType((TypeVariable<?>)targetType); return internalConvert(value, targetType); }
/** * Converts the supplied object to the supplied target type. * * @param value the object to be converted. * @param targetType the target type. * @return the converted object. */ public final Object convert(Object value, Type targetType) { if (targetType instanceof TypeVariable<?>) targetType = TypeUtil.getBoundType((TypeVariable<?>)targetType); return internalConvert(value, targetType); }
/** * Tells if the supplied object may be converted to the supplied target type by * this converter. * * @param value the object to be converted. * @param targetType the target type. * @return true if this converter can convert o to the target type, false otherwise. */ public final boolean canConvert(Object value, Type targetType) { if (targetType instanceof TypeVariable<?>) targetType = TypeUtil.getBoundType((TypeVariable<?>)targetType); return internalCanConvert(value, targetType); }
/** * Tells if the supplied object may be converted to the supplied target type by * this converter. * * @param value the object to be converted. * @param targetType the target type. * @return true if this converter can convert o to the target type, false otherwise. */ public final boolean canConvert(Object value, Type targetType) { if (targetType instanceof TypeVariable<?>) targetType = TypeUtil.getBoundType((TypeVariable<?>)targetType); return internalCanConvert(value, targetType); }
/** * Returns a suitable converter for supplied parameters or either returns null if no converter * can be found or throws a {@link NoConverterFoundException}. * * @param value the value to be converted * @param targetType the type of the converted value * @param throwNotFoundException should an exception be thrown if no converter is found? * @return a Converter instance or null if no suitable converter can be found * @throws NoConverterFoundException if the throwNotFoundException parameter is set to true * and no converter can be found. */ public Converter getConverter(Object value, Type targetType, boolean throwNotFoundException) throws NoConverterFoundException { // Small optimization: this avoids to make TypeVariable conversion in all converters... if (targetType instanceof TypeVariable<?>) targetType = TypeUtil.getBoundType((TypeVariable<?>)targetType); for (Converter converter : converters) { if (converter.canConvert(value, targetType)) return converter; } if (!throwNotFoundException) return null; throw new NoConverterFoundException(value, targetType); }
/** * Returns a suitable converter for supplied parameters or either returns null if no converter * can be found or throws a {@link NoConverterFoundException}. * * @param value the value to be converted * @param targetType the type of the converted value * @param throwNotFoundException should an exception be thrown if no converter is found? * @return a Converter instance or null if no suitable converter can be found * @throws NoConverterFoundException if the throwNotFoundException parameter is set to true * and no converter can be found. */ public Converter getConverter(Object value, Type targetType, boolean throwNotFoundException) throws NoConverterFoundException { // Small optimization: this avoids to make TypeVariable conversion in all converters... if (targetType instanceof TypeVariable<?>) targetType = TypeUtil.getBoundType((TypeVariable<?>)targetType); for (Converter converter : converters) { if (converter.canConvert(value, targetType)) return converter; } if (!throwNotFoundException) return null; throw new NoConverterFoundException(value, targetType); }
/** * Returns a suitable converter for supplied parameters or either returns null if no converter * can be found or throws a {@link NoConverterFoundException}. * * @param value the value to be converted * @param targetType the type of the converted value * @param throwNotFoundException should an exception be thrown if no converter is found? * @return a Converter instance or null if no suitable converter can be found * @throws NoConverterFoundException if the throwNotFoundException parameter is set to true * and no converter can be found. */ public Converter getConverter(Object value, Type targetType, boolean throwNotFoundException) throws NoConverterFoundException { // Small optimization: this avoids to make TypeVariable conversion in all converters... if (targetType instanceof TypeVariable<?>) targetType = TypeUtil.getBoundType((TypeVariable<?>)targetType); for (Converter converter : converters) { if (converter.canConvert(value, targetType)) return converter; } if (!throwNotFoundException) return null; throw new NoConverterFoundException(value, targetType); }
/** * Returns a suitable converter for supplied parameters or either returns null if no converter * can be found or throws a {@link NoConverterFoundException}. * * @param value the value to be converted * @param targetType the type of the converted value * @param throwNotFoundException should an exception be thrown if no converter is found? * @return a Converter instance or null if no suitable converter can be found * @throws NoConverterFoundException if the throwNotFoundException parameter is set to true * and no converter can be found. */ public Converter getConverter(Object value, Type targetType, boolean throwNotFoundException) throws NoConverterFoundException { // Small optimization: this avoids to make TypeVariable conversion in all converters... if (targetType instanceof TypeVariable<?>) targetType = TypeUtil.getBoundType((TypeVariable<?>)targetType); for (Converter converter : converters) { if (converter.canConvert(value, targetType)) return converter; } if (!throwNotFoundException) return null; throw new NoConverterFoundException(value, targetType); }