/** * Performs a conversion to the default type. This method is called if we do * not have a target class. In this case, the T parameter is not set. * Therefore, we can cast to it (which is required to fulfill the contract * of the method signature). * * @param <T> the type of the result object * @param targetClass the target class of the conversion * @param value the value to be converted * @return the converted value */ private <T> T convertToDefaultType(final Class<T> targetClass, final Object value) { @SuppressWarnings("unchecked") final T result = (T) convert(getDefaultType(), value); return result; }
/** * Performs a conversion to the default type. This method is called if we do * not have a target class. In this case, the T parameter is not set. * Therefore, we can cast to it (which is required to fulfill the contract * of the method signature). * * @param <T> the type of the result object * @param targetClass the target class of the conversion * @param value the value to be converted * @return the converted value */ private <T> T convertToDefaultType(final Class<T> targetClass, final Object value) { @SuppressWarnings("unchecked") final T result = (T) convert(getDefaultType(), value); return result; }
/** * Set the default value, converting as required. * <p> * If the default value is different from the type the * <code>Converter</code> handles, it will be converted * to the handled type. * * @param defaultValue The default value to be returned * if the value to be converted is missing or an error * occurs converting the value. * @throws ConversionException if an error occurs converting * the default value */ protected void setDefaultValue(final Object defaultValue) { useDefault = false; if (log().isDebugEnabled()) { log().debug("Setting default value: " + defaultValue); } if (defaultValue == null) { this.defaultValue = null; } else { this.defaultValue = convert(getDefaultType(), defaultValue); } useDefault = true; }
/** * Set the default value, converting as required. * <p> * If the default value is different from the type the * <code>Converter</code> handles, it will be converted * to the handled type. * * @param defaultValue The default value to be returned * if the value to be converted is missing or an error * occurs converting the value. * @throws ConversionException if an error occurs converting * the default value */ protected void setDefaultValue(final Object defaultValue) { useDefault = false; if (log().isDebugEnabled()) { log().debug("Setting default value: " + defaultValue); } if (defaultValue == null) { this.defaultValue = null; } else { this.defaultValue = convert(getDefaultType(), defaultValue); } useDefault = true; }
/** * Performs a conversion to the default type. This method is called if we do * not have a target class. In this case, the T parameter is not set. * Therefore, we can cast to it (which is required to fulfill the contract * of the method signature). * * @param <T> the type of the result object * @param targetClass the target class of the conversion * @param value the value to be converted * @return the converted value */ private <T> T convertToDefaultType(final Class<T> targetClass, final Object value) { @SuppressWarnings("unchecked") final T result = (T) convert(getDefaultType(), value); return result; }
/** * Set the default value, converting as required. * <p> * If the default value is different from the type the * <code>Converter</code> handles, it will be converted * to the handled type. * * @param defaultValue The default value to be returned * if the value to be converted is missing or an error * occurs converting the value. * @throws ConversionException if an error occurs converting * the default value */ protected void setDefaultValue(Object defaultValue) { useDefault = false; if (log().isDebugEnabled()) { log().debug("Setting default value: " + defaultValue); } if (defaultValue == null) { this.defaultValue = null; } else { this.defaultValue = convert(getDefaultType(), defaultValue); } useDefault = true; }
/** * Set the default value, converting as required. * <p> * If the default value is different from the type the * <code>Converter</code> handles, it will be converted * to the handled type. * * @param defaultValue The default value to be returned * if the value to be converted is missing or an error * occurs converting the value. * @throws ConversionException if an error occurs converting * the default value */ protected void setDefaultValue(final Object defaultValue) { useDefault = false; if (log().isDebugEnabled()) { log().debug("Setting default value: " + defaultValue); } if (defaultValue == null) { this.defaultValue = null; } else { this.defaultValue = convert(getDefaultType(), defaultValue); } useDefault = true; }
/** * Set the default value, converting as required. * <p> * If the default value is different from the type the * <code>Converter</code> handles, it will be converted * to the handled type. * * @param defaultValue The default value to be returned * if the value to be converted is missing or an error * occurs converting the value. * @throws ConversionException if an error occurs converting * the default value */ protected void setDefaultValue(Object defaultValue) { useDefault = false; if (log().isDebugEnabled()) { log().debug("Setting default value: " + defaultValue); } if (defaultValue == null) { this.defaultValue = null; } else { this.defaultValue = convert(getDefaultType(), defaultValue); } useDefault = true; }
/** * Set the default value, converting as required. * <p> * If the default value is different from the type the * <code>Converter</code> handles, it will be converted * to the handled type. * * @param defaultValue The default value to be returned * if the value to be converted is missing or an error * occurs converting the value. * @throws ConversionException if an error occurs converting * the default value */ protected void setDefaultValue(Object defaultValue) { useDefault = false; if (log().isDebugEnabled()) { log().debug("Setting default value: " + defaultValue); } if (defaultValue == null) { this.defaultValue = null; } else { this.defaultValue = convert(getDefaultType(), defaultValue); } useDefault = true; }
Class targetType = primitive(type == null ? getDefaultType() : type);
Class targetType = primitive(type == null ? getDefaultType() : type);
Class targetType = primitive(type == null ? getDefaultType() : type);