Code example for TypeDescriptor

Methods: getType

0
        return types;
    } 
 
    @Override 
    public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
        if (String.class.equals(sourceType.getType())) {
            if (StringUtils.isBlank((String) source)) {
                return null; 
            } 
            Long id = Long.parseLong((String) source);
            return this.em.find(this.clazz, id);
        } else if (this.clazz.equals(sourceType.getType())) {
            try { 
                if (source == null) {
                    return ""; 
                } else { 
                    return FieldUtils.readField(source, ID_FIELD, true).toString();
                } 
            } catch (IllegalAccessException e) {
            } 
Connect your IDE to all the code out there  Get Codota for Java