public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
        Assert.isInstanceOf(HibernateProxy.class, source, "Expected an instance of HibernateProxy to convert");
        Assert.isAssignable(HibernateProxy.class, sourceType.getType(), "Expected a subclass of HibernateProxy for the source type");
        HibernateProxy proxy = (HibernateProxy) source;
        boolean isField = targetType.getSource() instanceof Field;
        boolean isProperty = targetType.getSource() instanceof MethodParameter &&
            BeanUtils.findPropertyForMethod(((MethodParameter)targetType.getSource()).getMethod()) != null;

        if (isField || isProperty) {
            if (!Hibernate.isInitialized(proxy)) {
                return null;
            }
        }
        return proxy.getHibernateLazyInitializer().getImplementation();
    }
public Object convert ( Object source , TypeDescriptor sourceType , TypeDescriptor targetType ) { Assert . isInstanceOf ( HibernateProxy . class , source , "Expected an instance of HibernateProxy to convert" ) ; Assert . isAssignable ( HibernateProxy . class , sourceType . getType ( ) , "Expected a subclass of HibernateProxy for the source type" ) ; HibernateProxy proxy = ( HibernateProxy ) source ; boolean isField = targetType . getSource ( ) instanceof Field ; boolean isProperty = targetType . getSource ( ) instanceof MethodParameter && BeanUtils . findPropertyForMethod ( ( ( MethodParameter ) targetType . getSource ( ) ) . getMethod ( ) ) != null ; if ( isField || isProperty ) { if ( ! Hibernate . isInitialized ( proxy ) ) { return null ; } } return proxy . getHibernateLazyInitializer ( ) . getImplementation ( ) ; }
{@inheritDoc}