Class ReadOnlyObjects.GHMetaGettersFinalCreator

java.lang.Object
org.kohsuke.github.example.dataobject.ReadOnlyObjects.GHMetaGettersFinalCreator
All Implemented Interfaces:
ReadOnlyObjects.GHMetaExample
Enclosing class:
ReadOnlyObjects

public static class ReadOnlyObjects.GHMetaGettersFinalCreator extends Object implements ReadOnlyObjects.GHMetaExample
This version uses only public getters and returns unmodifiable lists

Pro:

  • Fields final and lists unmodifiable
  • Construction behavior can be controlled - if values depended on each other or needed to be set in a specific order, this could do that.
  • JsonProrperty "required" works on JsonCreator constructors - lets annotation define required values
Con:
  • There is no way you'd know about this without some research
  • Specific annotations needed
  • Nonnull annotations are misleading - null value is not checked even for "required" constructor parameters
  • Brittle and verbose - not friendly to large number of fields
Author:
Liam Newman
See Also: