use of org.grails.datastore.mapping.reflect.ClassPropertyFetcher in project grails-core by grails.
the class DomainClassMarshaller method asShortObject.
protected void asShortObject(Object refObj, XML xml, GrailsDomainClassProperty idProperty, GrailsDomainClass referencedDomainClass) throws ConverterException {
Object idValue;
if (proxyHandler instanceof EntityProxyHandler) {
idValue = ((EntityProxyHandler) proxyHandler).getProxyIdentifier(refObj);
if (idValue == null) {
ClassPropertyFetcher propertyFetcher = ClassPropertyFetcher.forClass(refObj.getClass());
idValue = propertyFetcher.getPropertyValue(refObj, idProperty.getName());
}
} else {
ClassPropertyFetcher propertyFetcher = ClassPropertyFetcher.forClass(refObj.getClass());
idValue = propertyFetcher.getPropertyValue(refObj, idProperty.getName());
}
xml.attribute(GrailsDomainClassProperty.IDENTITY, String.valueOf(idValue));
}
Aggregations