Class ReadOnlyObjects
- java.lang.Object
-
- org.kohsuke.github.example.dataobject.ReadOnlyObjects
-
public final class ReadOnlyObjects extends Object
GHMeta
wraps the list of GitHub's IP addresses.This class is used to show examples of different ways to create simple read-only data objects. For data objects that can be modified, perform actions, or get other objects we'll need other examples.
IMPORTANT: There is no one right way to do this, but there are better and worse.
- Better:
ReadOnlyObjects.GHMetaGettersUnmodifiable
is a good balance of clarity and brevity - Worse:
ReadOnlyObjects.GHMetaPublic
exposes setters that are not needed, making it unclear that fields are actually read-only
- Better:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ReadOnlyObjects.GHMetaExample
All GHMeta data objects should expose these values.static class
ReadOnlyObjects.GHMetaGettersFinal
This version uses only public getters and returns unmodifiable lists and has final fieldsstatic class
ReadOnlyObjects.GHMetaGettersFinalCreator
This version uses only public getters and returns unmodifiable listsstatic class
ReadOnlyObjects.GHMetaGettersUnmodifiable
This version uses only public getters and returns unmodifiable lists.static class
ReadOnlyObjects.GHMetaPackage
This version uses public getters and shows that package or private setters both can be used by jackson.static class
ReadOnlyObjects.GHMetaPublic
This version uses public getters and setters and leaves it up to Jackson how it wants to fill them.
-
Constructor Summary
Constructors Constructor Description ReadOnlyObjects()
-