Class ReadOnlyObjects
- java.lang.Object
-
- org.kohsuke.github.example.dataobject.ReadOnlyObjects
-
public final class ReadOnlyObjects extends Object
GHMetawraps 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.GHMetaGettersUnmodifiableis a good balance of clarity and brevity - Worse:
ReadOnlyObjects.GHMetaPublicexposes 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 interfaceReadOnlyObjects.GHMetaExampleAll GHMeta data objects should expose these values.static classReadOnlyObjects.GHMetaGettersFinalThis version uses only public getters and returns unmodifiable lists and has final fieldsstatic classReadOnlyObjects.GHMetaGettersFinalCreatorThis version uses only public getters and returns unmodifiable listsstatic classReadOnlyObjects.GHMetaGettersUnmodifiableThis version uses only public getters and returns unmodifiable lists.static classReadOnlyObjects.GHMetaPackageThis version uses public getters and shows that package or private setters both can be used by jackson.static classReadOnlyObjects.GHMetaPublicThis version uses public getters and setters and leaves it up to Jackson how it wants to fill them.
-
Constructor Summary
Constructors Constructor Description ReadOnlyObjects()
-