Class Choice
- All Implemented Interfaces:
Describable<Choice>,Serializable
A single selectable option offered to the human, optionally carrying a
why rationale
that explains, in plain language, when this option is the right one.
Instances are immutable once constructed and are safe to persist via XStream and to serialise across a Jenkins restart.
It is a Describable (B17) so the askInteractive step's
config.jelly can render the choice list as a repeatable nested form block in the Pipeline
Snippet Generator. The descriptor adds no persisted state, so existing XStream data is unaffected.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDescriptor soChoiceis a first-classDescribablefor the step's repeatable choice form (B17). -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.model.Describable
getDescriptor
-
Constructor Details
-
Choice
- Parameters:
id- stable identifier returned to the pipeline when this choice is picked (required)label- human-readable label shown in the UI (required)
-
-
Method Details
-
setWhy
- Parameters:
why- optional rationale shown in muted text beneath the label
-
getId
-
getLabel
-
getWhy
-
toJson
@NonNull public net.sf.json.JSONObject toJson()- Returns:
- this choice as a JSON object with
id,labeland (if present)why. Values are stored raw; JSON string escaping is handled by the JSON library and HTML escaping is the caller/Jelly's responsibility.
-