Class OptionalIterable<T>

java.lang.Object
com.atlassian.jira.rest.client.api.OptionalIterable<T>
All Implemented Interfaces:
Iterable<T>

public class OptionalIterable<T> extends Object implements Iterable<T>
Represent iterable which is optional (for example due to lack of field in old REST API version).

This iterable is intended to be not null, so you can always get items by using iterator. If you need to check if value was actually provided then use isSupported().

Since:
v1.0
  • Constructor Details

    • OptionalIterable

      public OptionalIterable(@Nullable Iterable<T> iterable)
  • Method Details

    • absent

      public static <T> OptionalIterable<T> absent()
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
      Returns:
      iterator for original iterable if isSupported() is true, or empty iterator in other case.
    • isSupported

      public boolean isSupported()
      Returns:
      true if server supports this field
    • toString

      public String toString()
      Overrides:
      toString in class Object