Trims all Strings encountered within an Object graph recursively.
This utility uses Java Reflection API to traverse through an object graph with disciplined syntax of getters and setters and recursively trims the String properties.
- If the current level of
Property
is of typeString
- If its an
Object
Array of Properties - If its a
String
array - If its a type of Java
Collection
class - Separate placement for
Map
with special conditions to process itskeys
andvalues
Next Steps
- Handle undisciplined syntax of properties (invalid getters/setters)
- Handle chained Collections: for example,
List<List<Person>>
Guava
collection library support