Package com.jcabi.github
Class IssueLabels.Smart
- java.lang.Object
-
- com.jcabi.github.IssueLabels.Smart
-
- All Implemented Interfaces:
IssueLabels
- Enclosing interface:
- IssueLabels
@Immutable @Loggable(1) public static final class IssueLabels.Smart extends Object implements IssueLabels
Smart IssueLabels with extra features.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jcabi.github.IssueLabels
IssueLabels.Smart
-
-
Constructor Summary
Constructors Constructor Description Smart(IssueLabels lbl)Public ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Iterable<String> names)Add new labels.booleanaddIfAbsent(String name)Add label if it is absent, don't touch its color if exists.booleanaddIfAbsent(String name, String color)Add label if it is absent, and set its color in any case.voidclear()Remove all labels.booleancontains(String name)Label exists?Collection<Label>findByColor(String color)Select all labels with the given color.Labelget(String name)Get label by name (runtime exception if absent).Issueissue()The issue we're in.Iterable<Label>iterate()Iterate them all.voidremove(String name)Remove label by name.booleanremoveIfExists(String name)Remove label if it exists (do nothing otherwise).voidreplace(Iterable<String> names)Replace all labels.
-
-
-
Constructor Detail
-
Smart
public Smart(IssueLabels lbl)
Public ctor.- Parameters:
lbl- Labels
-
-
Method Detail
-
contains
public boolean contains(String name)
Label exists?- Parameters:
name- Name of the label- Returns:
- TRUE if it exists
-
get
public Label get(String name)
Get label by name (runtime exception if absent).- Parameters:
name- Name of the label- Returns:
- Label found (exception if not found)
- Since:
- 0.7
-
addIfAbsent
public boolean addIfAbsent(String name) throws IOException
Add label if it is absent, don't touch its color if exists.- Parameters:
name- Name of the label- Returns:
- TRUE if it was added
- Throws:
IOException- If there is any I/O problem
-
addIfAbsent
public boolean addIfAbsent(String name, String color) throws IOException
Add label if it is absent, and set its color in any case.- Parameters:
name- Name of the labelcolor- Color to set- Returns:
- TRUE if it was added
- Throws:
IOException- If there is any I/O problem- Since:
- 0.7
-
findByColor
public Collection<Label> findByColor(String color) throws IOException
Select all labels with the given color.- Parameters:
color- Color- Returns:
- Collection of labels with the provided color
- Throws:
IOException- If there is any I/O problem- Since:
- 0.7
-
removeIfExists
public boolean removeIfExists(String name) throws IOException
Remove label if it exists (do nothing otherwise).- Parameters:
name- Label to remove- Returns:
- TRUE if it was removed, FALSE otherwise
- Throws:
IOException- If there is any I/O problem- Since:
- 0.7
-
issue
public Issue issue()
Description copied from interface:IssueLabelsThe issue we're in.- Specified by:
issuein interfaceIssueLabels- Returns:
- Issue
-
add
public void add(Iterable<String> names) throws IOException
Description copied from interface:IssueLabelsAdd new labels.- Specified by:
addin interfaceIssueLabels- Parameters:
names- The labels to add- Throws:
IOException- If there is any I/O problem- See Also:
- Add labels to an issue
-
replace
public void replace(Iterable<String> names) throws IOException
Description copied from interface:IssueLabelsReplace all labels.- Specified by:
replacein interfaceIssueLabels- Parameters:
names- The labels to save- Throws:
IOException- If there is any I/O problem- See Also:
- Replace all labels for an issue
-
iterate
public Iterable<Label> iterate()
Description copied from interface:IssueLabelsIterate them all.- Specified by:
iteratein interfaceIssueLabels- Returns:
- Iterator of labels
- See Also:
- List Labels on an Issue
-
remove
public void remove(String name) throws IOException
Description copied from interface:IssueLabelsRemove label by name.- Specified by:
removein interfaceIssueLabels- Parameters:
name- Name of the label to remove- Throws:
IOException- If there is any I/O problem- See Also:
- Remove a Label from an Issue
-
clear
public void clear() throws IOExceptionDescription copied from interface:IssueLabelsRemove all labels.- Specified by:
clearin interfaceIssueLabels- Throws:
IOException- If there is any I/O problem- See Also:
- Remove all labels from an issue
-
-