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.
Since:
0.1
  • Constructor Details

    • Smart

      public Smart(IssueLabels lbl)
      Public ctor.
      Parameters:
      lbl - Labels
  • Method Details

    • 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 label
      color - 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 interface IssueLabels
      Returns:
      Issue
    • add

      public void add(Iterable<String> names) throws IOException
      Description copied from interface: IssueLabels
      Add new labels.
      Specified by:
      add in interface IssueLabels
      Parameters:
      names - The labels to add
      Throws:
      IOException - If there is any I/O problem
      See Also:
    • replace

      public void replace(Iterable<String> names) throws IOException
      Description copied from interface: IssueLabels
      Replace all labels.
      Specified by:
      replace in interface IssueLabels
      Parameters:
      names - The labels to save
      Throws:
      IOException - If there is any I/O problem
      See Also:
    • iterate

      public Iterable<Label> iterate()
      Description copied from interface: IssueLabels
      Iterate them all.
      Specified by:
      iterate in interface IssueLabels
      Returns:
      Iterator of labels
      See Also:
    • remove

      public void remove(String name) throws IOException
      Description copied from interface: IssueLabels
      Remove label by name.
      Specified by:
      remove in interface IssueLabels
      Parameters:
      name - Name of the label to remove
      Throws:
      IOException - If there is any I/O problem
      See Also:
    • clear

      public void clear() throws IOException
      Description copied from interface: IssueLabels
      Remove all labels.
      Specified by:
      clear in interface IssueLabels
      Throws:
      IOException - If there is any I/O problem
      See Also: