Example usage for org.springframework.beans TypeConverter getClass

List of usage examples for org.springframework.beans TypeConverter getClass

Introduction

In this page you can find the example usage for org.springframework.beans TypeConverter getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.surveypanel.form.Form.java

/**
 * Convert the given value from one type to another using the converter assigned to the given FormElement.
 *
 * @param question The FormElement/* w  w  w . j  ava2  s  .co m*/
 * @param value The value
 * @param locale The locale
 * @return The new typed object
 * @throws Exception Any exception
 */
protected Object convert(QuestionImpl question, Object value, Locale locale) throws Exception {
    if (value == null) {
        return null;
    }

    TypeConverter typeConverter = new SimpleTypeConverter();

    if (typeConverter != null) {
        if (log.isDebugEnabled())
            log.debug("Converting " + value + " of type " + value.getClass() + " using "
                    + typeConverter.getClass());
        value = typeConverter.convertIfNecessary(value, null);
        if (log.isDebugEnabled()) {
            log.debug("New value: " + value);
            log.debug("New type: " + value.getClass());
        }
    }
    return value;
}