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 void
add(Iterable<String> names)
Add new labels.boolean
addIfAbsent(String name)
Add label if it is absent, don't touch its color if exists.boolean
addIfAbsent(String name, String color)
Add label if it is absent, and set its color in any case.void
clear()
Remove all labels.boolean
contains(String name)
Label exists?Collection<Label>
findByColor(String color)
Select all labels with the given color.Label
get(String name)
Get label by name (runtime exception if absent).Issue
issue()
The issue we're in.Iterable<Label>
iterate()
Iterate them all.void
remove(String name)
Remove label by name.boolean
removeIfExists(String name)
Remove label if it exists (do nothing otherwise).void
replace(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:IssueLabels
The issue we're in.- Specified by:
issue
in interfaceIssueLabels
- Returns:
- Issue
-
add
public void add(Iterable<String> names) throws IOException
Description copied from interface:IssueLabels
Add new labels.- Specified by:
add
in 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:IssueLabels
Replace all labels.- Specified by:
replace
in 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:IssueLabels
Iterate them all.- Specified by:
iterate
in interfaceIssueLabels
- Returns:
- Iterator of labels
- See Also:
- List Labels on an Issue
-
remove
public void remove(String name) throws IOException
Description copied from interface:IssueLabels
Remove label by name.- Specified by:
remove
in 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 IOException
Description copied from interface:IssueLabels
Remove all labels.- Specified by:
clear
in interfaceIssueLabels
- Throws:
IOException
- If there is any I/O problem- See Also:
- Remove all labels from an issue
-
-