1. Jason Stonebraker
  2. JSONExclusionMarshaller
  3. Issues
Issue #1 resolved

Support Non-Domain Class POGOs

Jason Stonebraker
repo owner created an issue

Story
As a user of the JsonExclusionMarshaller plugin
I want to be able to apply the excludeFor*() method to any pogo (not just Grails Domain Classes)
So that I can benefit from the plugins functionality on a larger range of classes

Problem:
Currently the injected marshaller assumes the existence of the 'id' and 'class' properties. This reduces the use of the plugin to GORM enhanced Domain Classes.

Solution:
This enhancement will follow the original GroovyBeanMarshaller's method of determining which properties should be included in the original map, prior to the excluding the specified properties.

Acceptance Criteria:
Given an instance of a TestStudent class
When I use the excludeFor*() method and specify the socialSecurityNumber property for exclusion
Then the result of the JSON conversion should be:

{"firstName":"Tobias","gradePointAverage":3.6,"lastName":"Funke",
"studentID":"FS-210-7312"}

Context

student = new TestStudent([
    firstName: "Tobias",
    lastName: "Funke",
    gradePointAverage: 3.6,
    studentID: "FS-210-7312",
    socialSecurityNumber: "555-55-5555" 
])

Comments (3)

  1. Log in to comment