EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.blobstore.options]

COVERAGE SUMMARY FOR SOURCE FILE [ListOptions.java]

nameclass, %method, %block, %line, %
ListOptions.java67%  (2/3)44%  (8/18)51%  (53/104)59%  (17/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ListOptions$Builder0%   (0/1)0%   (0/3)0%   (0/19)0%   (0/5)
ListOptions$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
afterMarker (String): ListOptions 0%   (0/1)0%   (0/8)0%   (0/2)
maxResults (int): ListOptions 0%   (0/1)0%   (0/8)0%   (0/2)
     
class ListOptions$ImmutableListOptions100% (1/1)14%  (1/7)20%  (6/30)33%  (3/9)
afterMarker (String): ListContainerOptions 0%   (0/1)0%   (0/4)0%   (0/1)
clone (): ListOptions 0%   (0/1)0%   (0/4)0%   (0/1)
getMarker (): String 0%   (0/1)0%   (0/4)0%   (0/1)
getMaxResults (): Integer 0%   (0/1)0%   (0/4)0%   (0/1)
maxResults (int): ListContainerOptions 0%   (0/1)0%   (0/4)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/4)0%   (0/1)
ListOptions$ImmutableListOptions (ListOptions): void 100% (1/1)100% (6/6)100% (3/3)
     
class ListOptions100% (1/1)88%  (7/8)85%  (47/55)93%  (14/15)
clone (): ListOptions 0%   (0/1)0%   (0/8)0%   (0/1)
<static initializer> 100% (1/1)100% (8/8)100% (1/1)
ListOptions (): void 100% (1/1)100% (3/3)100% (2/2)
ListOptions (Integer, String): void 100% (1/1)100% (9/9)100% (4/4)
afterMarker (String): ListOptions 100% (1/1)100% (8/8)100% (2/2)
getMarker (): String 100% (1/1)100% (3/3)100% (1/1)
getMaxResults (): Integer 100% (1/1)100% (3/3)100% (1/1)
maxResults (int): ListOptions 100% (1/1)100% (13/13)100% (3/3)

1/**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *   http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.jclouds.blobstore.options;
20 
21import static com.google.common.base.Preconditions.checkArgument;
22import static com.google.common.base.Preconditions.checkNotNull;
23 
24/**
25 * Contains options supported in the list container operation. <h2>
26 * Usage</h2> The recommended way to instantiate a ListOptions object is to statically import
27 * ListOptions.* and invoke a static creation method followed by an instance mutator (if needed):
28 * <p/>
29 * <code>
30 * import static org.jclouds.blobstore.options.ListOptions.Builder.*
31 * <p/>
32 * BlobStore connection = // get connection
33 * Future<BoundedSortedSet<ResourceMetadata>> list = connection.list(maxResults(1000));
34 * <code>
35 * 
36 * @author Adrian Cole
37 */
38public class ListOptions implements Cloneable {
39 
40   public static class ImmutableListOptions extends ListOptions {
41      private final ListOptions delegate;
42 
43      @Override
44      public ListContainerOptions afterMarker(String marker) {
45         throw new UnsupportedOperationException();
46      }
47 
48      public ImmutableListOptions(ListOptions delegate) {
49         this.delegate = delegate;
50      }
51 
52      @Override
53      public ListContainerOptions maxResults(int maxKeys) {
54         throw new UnsupportedOperationException();
55      }
56 
57      @Override
58      public String getMarker() {
59         return delegate.getMarker();
60      }
61 
62      @Override
63      public Integer getMaxResults() {
64         return delegate.getMaxResults();
65      }
66 
67      @Override
68      public ListOptions clone() {
69         return delegate.clone();
70      }
71 
72      @Override
73      public String toString() {
74         return delegate.toString();
75      }
76   }
77 
78   public static final ImmutableListOptions NONE = new ImmutableListOptions(new ListOptions());
79 
80   ListOptions(Integer maxKeys, String marker) {
81      this.maxKeys = maxKeys;
82      this.marker = marker;
83   }
84 
85   public ListOptions() {
86   }
87 
88   private Integer maxKeys;
89   private String marker;
90 
91   public Integer getMaxResults() {
92      return maxKeys;
93   }
94 
95   public String getMarker() {
96      return marker;
97   }
98 
99   /**
100    * Place to continue a listing at. This must be the value returned from the last list object, as
101    * not all blobstores use lexigraphic lists.
102    */
103   public ListOptions afterMarker(String marker) {
104      this.marker = checkNotNull(marker, "marker");
105      return this;
106   }
107 
108   /**
109    * The maximum number of values you'd like to see in the response body. The server might return
110    * fewer than this many values, but will not return more.
111    */
112   public ListOptions maxResults(int maxKeys) {
113      checkArgument(maxKeys >= 0, "maxKeys must be >= 0");
114      this.maxKeys = maxKeys;
115      return this;
116   }
117 
118   public static class Builder {
119 
120      /**
121       * @see ListOptions#afterMarker(String)
122       */
123      public static ListOptions afterMarker(String marker) {
124         ListOptions options = new ListOptions();
125         return options.afterMarker(marker);
126      }
127 
128      /**
129       * @see ListOptions#maxResults(int)
130       */
131      public static ListOptions maxResults(int maxKeys) {
132         ListOptions options = new ListOptions();
133         return options.maxResults(maxKeys);
134      }
135 
136   }
137 
138   @Override
139   protected ListOptions clone() {
140      return new ListOptions(maxKeys, marker);
141   }
142}

[all classes][org.jclouds.blobstore.options]
EMMA 2.0.5312 (C) Vladimir Roubtsov