@ Override public T convert ( final Object value ) { if ( value == null ) { return null ; } else if ( isIterable ( ) && Iterable . class . isAssignableFrom ( value . getClass ( ) ) ) { return convertIterable ( value ) ; } else if ( reflectedKlass . assignableFromObject ( value ) ) { return ( T ) value ; } else if ( reflectedKlass . canBeUnboxed ( value . getClass ( ) ) ) { return ( T ) value ; } else if ( reflectedKlass . canBeBoxed ( value . getClass ( ) ) ) { return ( T ) value ; } FluentClass < ? > klassToCreate ; if ( reflectedKlass . isPrimitive ( ) ) { klassToCreate = reflectedKlass . boxedType ( ) ; } else { klassToCreate = reflectedKlass ; } return ( T ) convertValueTo ( value , klassToCreate ) ; }
If T is assignable from value then return the value . Otherwise tries to create an instance of this type using the provided argument .