@BoxResourceType(value="collection") public class BoxCollection extends BoxResource implements Iterable<BoxItem.Info>
Unless otherwise noted, the methods in this class can throw an unchecked BoxAPIException
(unchecked
meaning that the compiler won't force you to handle it) if an error occurs. If you wish to implement custom error
handling for errors related to the Box REST API, you should capture this exception explicitly.
Modifier and Type | Class and Description |
---|---|
class |
BoxCollection.Info
Contains information about a BoxCollection.
|
Modifier and Type | Field and Description |
---|---|
static URLTemplate |
GET_COLLECTION_ITEMS_URL
Get Collection Items URL Template.
|
static URLTemplate |
GET_COLLECTIONS_URL_TEMPLATE
Get Collections URL Template.
|
Constructor and Description |
---|
BoxCollection(BoxAPIConnection api,
String id)
Constructs a BoxCollection for a collection with a given ID.
|
Modifier and Type | Method and Description |
---|---|
static Iterable<BoxCollection.Info> |
getAllCollections(BoxAPIConnection api)
Gets an iterable of all the collections for the given user.
|
Iterable<BoxItem.Info> |
getItems()
Returns an iterable containing the items in this collection.
|
Iterable<BoxItem.Info> |
getItems(String... fields)
Returns an iterable containing the items in this collection and specifies which attributes to include in the
response.
|
PartialCollection<BoxItem.Info> |
getItemsRange(long offset,
long limit,
String... fields)
Retrieves a specific range of items in this collection.
|
Iterator<BoxItem.Info> |
iterator()
Returns an iterator over the items in this collection.
|
equals, getAPI, getID, getResourceType, hashCode
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public static final URLTemplate GET_COLLECTIONS_URL_TEMPLATE
public static final URLTemplate GET_COLLECTION_ITEMS_URL
public BoxCollection(BoxAPIConnection api, String id)
api
- the API connection to be used by the collection.id
- the ID of the collection.public static Iterable<BoxCollection.Info> getAllCollections(BoxAPIConnection api)
api
- the API connection to be used when retrieving the collections.public Iterable<BoxItem.Info> getItems()
public Iterable<BoxItem.Info> getItems(String... fields)
fields
- the fields to retrieve.public PartialCollection<BoxItem.Info> getItemsRange(long offset, long limit, String... fields)
offset
- the index of the first item to retrieve.limit
- the maximum number of items to retrieve after the offset.fields
- the fields to retrieve.public Iterator<BoxItem.Info> iterator()
iterator
in interface Iterable<BoxItem.Info>