Search in sources :

Example 1 with NameAwareMarshaller

use of org.grails.web.converters.marshaller.NameAwareMarshaller in project grails-core by grails.

the class XML method getElementName.

public String getElementName(Object o) {
    ObjectMarshaller<XML> om = config.getMarshaller(o);
    if (om instanceof NameAwareMarshaller) {
        return ((NameAwareMarshaller) om).getElementName(o);
    }
    final ProxyHandler proxyHandler = config.getProxyHandler();
    if (proxyHandler.isProxy(o) && (proxyHandler instanceof EntityProxyHandler)) {
        EntityProxyHandler entityProxyHandler = (EntityProxyHandler) proxyHandler;
        final Class<?> cls = entityProxyHandler.getProxiedClass(o);
        return GrailsNameUtils.getPropertyName(cls);
    }
    return GrailsNameUtils.getPropertyName(o.getClass());
}
Also used : EntityProxyHandler(grails.core.support.proxy.EntityProxyHandler) EntityProxyHandler(grails.core.support.proxy.EntityProxyHandler) ProxyHandler(grails.core.support.proxy.ProxyHandler) NameAwareMarshaller(org.grails.web.converters.marshaller.NameAwareMarshaller)

Aggregations

EntityProxyHandler (grails.core.support.proxy.EntityProxyHandler)1 ProxyHandler (grails.core.support.proxy.ProxyHandler)1 NameAwareMarshaller (org.grails.web.converters.marshaller.NameAwareMarshaller)1