grails.plugin.json.view.api.jsonapi.DefaultJsonApiIdRenderer.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of views-json Show documentation
Show all versions of views-json Show documentation
Provides additional view technologies to the Grails framework, including JSON and Markup views.
The newest version!
package grails.plugin.json.view.api.jsonapi
import groovy.transform.CompileStatic
import org.grails.datastore.mapping.model.PersistentProperty
@CompileStatic
class DefaultJsonApiIdRenderer implements JsonApiIdRenderStrategy {
@Override
Object render(Object object, PersistentProperty property) {
final String propertyName = property.name
if (object && object.hasProperty(propertyName)) {
return object.getAt(propertyName).toString()
}
}
}