public static Class < ? > getPropertyType ( Class < ? > clazz , String propertyName ) { if ( clazz == null || ! StringUtils . hasText ( propertyName ) ) { return null ; } try { PropertyDescriptor desc = BeanUtils . getPropertyDescriptor ( clazz , propertyName ) ; if ( desc != null ) { return desc . getPropertyType ( ) ; } return null ; } catch ( Exception e ) { // if there are any errors in instantiating just return null for the moment return null ; } }
Returns the type of the given property contained within the specified class