spring-hateoas-ext/src/main/java/de/escalon/hypermedia/spring/xhtml/XhtmlResourceMessageConverter.java
private void writeResource(XhtmlWriter writer, Object object) {
        if (object == null) {
            return;
        }
        try {
            if (object instanceof Resource) {
                Resource<?> resource = (Resource<?>) object;
                writer.beginListItem();

                writeResource(writer, resource.getContent());
                writer.writeLinks(resource.getLinks());

                writer.endListItem();
            } else if (object instanceof Resources) {
                Resources<?> resources = (Resources<?>) object;
                // TODO set name using EVO see HypermediaSupportBeanDefinitionRegistrar

                writer.beginListItem();

                writer.beginUnorderedList();
                Collection<?> content = resources.getContent();
                writeResource(writer, content);
                writer.endUnorderedList();

                writer.writeLinks(resources.getLinks());

                writer.endListItem();
            } else if (object instanceof ResourceSupport) {
                ResourceSupport resource = (ResourceSupport) object;
                writer.beginListItem();

                writeObject(writer, resource);
                writer.writeLinks(resource.getLinks());

                writer.endListItem();
            } else if (object instanceof Collection) {
                Collection<?> collection = (Collection<?>) object;
                for (Object item : collection) {
                    writeResource(writer, item);
                }
            } else { // TODO: write li for simple objects in Resources Collection
                writeObject(writer, object);
            }
        } catch (Exception ex) {
            throw new RuntimeException("failed to transform object " + object, ex);
        }
    }
private void writeResource(XhtmlWriter writer, Object object) {
        if (object == null) {
            return;
        }
        try {
            if (object instanceof Resource) {
                Resource<?> resource = (Resource<?>) object;
                writer.beginListItem();

                writeResource(writer, resource.getContent());
                writer.writeLinks(resource.getLinks());

                writer.endListItem();
            } else if (object instanceof Resources) {
                Resources<?> resources = (Resources<?>) object;
                // TODO set name using EVO see HypermediaSupportBeanDefinitionRegistrar

                writer.beginListItem();

                writer.beginUnorderedList();
                Collection<?> content = resources.getContent();
                writeResource(writer, content);
                writer.endUnorderedList();

                writer.writeLinks(resources.getLinks());

                writer.endListItem();
            } else if (object instanceof ResourceSupport) {
                ResourceSupport resource = (ResourceSupport) object;
                writer.beginListItem();

                writeObject(writer, resource);
                writer.writeLinks(resource.getLinks());

                writer.endListItem();
            } else if (object instanceof Collection) {
                Collection<?> collection = (Collection<?>) object;
                for (Object item : collection) {
                    writeResource(writer, item);
                }
            } else { // TODO: write li for simple objects in Resources Collection
                writeObject(writer, object);
            }
        } catch (Exception ex) {
            throw new RuntimeException("failed to transform object " + object, ex);
        }
    }
private void writeResource ( XhtmlWriter writer , Object object ) { if ( object == null ) { return ; } try { if ( object instanceof Resource ) { Resource < ? > resource = ( Resource < ? > ) object ; writer . beginListItem ( ) ; writeResource ( writer , resource . getContent ( ) ) ; writer . writeLinks ( resource . getLinks ( ) ) ; writer . endListItem ( ) ; } else if ( object instanceof Resources ) { Resources < ? > resources = ( Resources < ? > ) object ; // TODO set name using EVO see HypermediaSupportBeanDefinitionRegistrar writer . beginListItem ( ) ; writer . beginUnorderedList ( ) ; Collection < ? > content = resources . getContent ( ) ; writeResource ( writer , content ) ; writer . endUnorderedList ( ) ; writer . writeLinks ( resources . getLinks ( ) ) ; writer . endListItem ( ) ; } else if ( object instanceof ResourceSupport ) { ResourceSupport resource = ( ResourceSupport ) object ; writer . beginListItem ( ) ; writeObject ( writer , resource ) ; writer . writeLinks ( resource . getLinks ( ) ) ; writer . endListItem ( ) ; } else if ( object instanceof Collection ) { Collection < ? > collection = ( Collection < ? > ) object ; for ( Object item : collection ) { writeResource ( writer , item ) ; } } else { // TODO: write li for simple objects in Resources Collection writeObject ( writer , object ) ; } } catch ( Exception ex ) { throw new RuntimeException ( "failed to transform object " + object , ex ) ; } }
Recursively converts object to xhtml data.

@param object
to convert
@param writer
to write to
Recursively converts object to xhtml data .