com.atlassian.jira.rest.client.api
Class OptionalIterable<T>

java.lang.Object
  extended by 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 Summary
OptionalIterable(Iterable<T> iterable)
           
 
Method Summary
static
<T> OptionalIterable<T>
absent()
           
 boolean isSupported()
           
 Iterator<T> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptionalIterable

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

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


Copyright © 2013 Atlassian. All Rights Reserved.