Package hudson.model.labels
Class LabelAtom
- java.lang.Object
-
- hudson.model.AbstractModelObject
-
- hudson.model.Actionable
-
- hudson.model.Label
-
- hudson.model.labels.LabelAtom
-
- All Implemented Interfaces:
ModelObject,Saveable,SearchableModelObject,SearchItem,Comparable<Label>,ModelObjectWithChildren,ModelObjectWithContextMenu
public class LabelAtom extends Label implements Saveable
Atomic single token label, like "foo" or "bar".- Since:
- 1.372
- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class hudson.model.Label
Label.ConverterImpl
-
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType
-
-
Field Summary
Fields Modifier and Type Field Description protected List<Action>transientActions-
Fields inherited from class hudson.model.Label
loadStatistics, name, nodeProvisioner
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <V,P>
Vaccept(LabelVisitor<V,P> visitor, P param)Accepts a visitor and call its respective "onXYZ" method based no the actual type of 'this'.voiddoConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)Accepts the update to the node configuration.voiddoSubmitDescription(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)Accepts the new description.static Stringescape(String name)static LabelAtomfindNearest(String name)static LabelAtomget(String l)Obtains an atom by its name.List<Action>getActions()Gets actions contributed to this object.List<LabelAtomPropertyDescriptor>getApplicablePropertyDescriptors()Returns all theLabelAtomPropertyDescriptors that can be potentially configured on this label.StringgetDescription()Returns a human readable text that explains this label.StringgetExpression()If the label contains 'unsafe' chars, escape them.DescribableList<LabelAtomProperty,LabelAtomPropertyDescriptor>getProperties()Properties associated with this label.List<LabelAtomProperty>getPropertiesList()booleanisAtom()Returns true iff this label is an atom.Set<LabelAtom>listAtoms()Lists up all the atoms contained in in this label.voidload()booleanmatches(VariableResolver<Boolean> resolver)Evaluates whether the label expression is true given the specified value assignment.static booleanneedsEscape(String name)LabelOperatorPrecedenceprecedence()Precedence of the top most operator.voidsave()Persists the state of this object into XML.voidsetDescription(String description)protected voidupdateTransientActions()-
Methods inherited from class hudson.model.Label
and, compareTo, contains, doChildrenContextMenu, equals, getApi, getBusyExecutors, getClouds, getDisplayName, getIdleExecutors, getName, getNodes, getSearchUrl, getSortedNodes, getTiedJobCount, getTiedJobs, getTotalConfiguredExecutors, getTotalExecutors, getUrl, hashCode, iff, implies, isAssignable, isEmpty, isOffline, isSelfLabel, matches, matches, not, or, paren, parse, parseExpression, toString
-
Methods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, getAction, getAction, getActions, getAllActions, getDynamic, removeAction, removeActions, replaceAction, replaceActions
-
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
-
-
-
-
Field Detail
-
transientActions
@CopyOnWrite protected transient volatile List<Action> transientActions
-
-
Constructor Detail
-
LabelAtom
public LabelAtom(@NonNull String name)
-
-
Method Detail
-
getExpression
public String getExpression()
If the label contains 'unsafe' chars, escape them.- Specified by:
getExpressionin classLabel
-
isAtom
public boolean isAtom()
Description copied from class:LabelReturns true iff this label is an atom.
-
getActions
@NonNull public List<Action> getActions()
Gets actions contributed to this object.A new
Actioncan be added byActionable.addAction(hudson.model.Action).If you are reading the list, rather than modifying it, use
Actionable.getAllActions()instead. This method by default returns only persistent actions (though some subclasses override it to return an extended unmodifiable list).Note that this method returns a read-only view of
Actions.LabelAtomPropertys who want to add a project action should do so by implementingLabelAtomProperty.getActions(LabelAtom).- Overrides:
getActionsin classActionable- Returns:
- a possibly empty list
-
updateTransientActions
protected void updateTransientActions()
-
getDescription
public String getDescription()
Description copied from class:LabelReturns a human readable text that explains this label.- Overrides:
getDescriptionin classLabel- Since:
- 1.580
-
setDescription
public void setDescription(String description) throws IOException
- Throws:
IOException
-
getProperties
public DescribableList<LabelAtomProperty,LabelAtomPropertyDescriptor> getProperties()
Properties associated with this label.
-
getPropertiesList
@Exported public List<LabelAtomProperty> getPropertiesList()
-
matches
public boolean matches(VariableResolver<Boolean> resolver)
Description copied from class:LabelEvaluates whether the label expression is true given the specified value assignment. IOW, returns true if the assignment provided by the resolver matches this label expression.
-
accept
public <V,P> V accept(LabelVisitor<V,P> visitor, P param)
Description copied from class:LabelAccepts a visitor and call its respective "onXYZ" method based no the actual type of 'this'.
-
listAtoms
public Set<LabelAtom> listAtoms()
Description copied from class:LabelLists up all the atoms contained in in this label.
-
precedence
public LabelOperatorPrecedence precedence()
Description copied from class:LabelPrecedence of the top most operator.- Specified by:
precedencein classLabel
-
save
public void save() throws IOExceptionDescription copied from interface:SaveablePersists the state of this object into XML.For making a bulk change efficiently, see
BulkChange.To support listeners monitoring changes to this object, call
SaveableListener.fireOnChange(hudson.model.Saveable, hudson.XmlFile)- Specified by:
savein interfaceSaveable- Throws:
IOException- if the persistence failed.
-
load
public void load()
-
getApplicablePropertyDescriptors
public List<LabelAtomPropertyDescriptor> getApplicablePropertyDescriptors()
Returns all theLabelAtomPropertyDescriptors that can be potentially configured on this label.
-
doConfigSubmit
@POST public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormExceptionAccepts the update to the node configuration.- Throws:
IOExceptionjavax.servlet.ServletExceptionDescriptor.FormException
-
doSubmitDescription
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public void doSubmitDescription(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletExceptionAccepts the new description.- Throws:
IOExceptionjavax.servlet.ServletException
-
get
@Nullable public static LabelAtom get(@CheckForNull String l)
Obtains an atom by its name.- See Also:
Jenkins.getLabelAtom(java.lang.String)
-
needsEscape
public static boolean needsEscape(String name)
-
-