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

COVERAGE SUMMARY FOR SOURCE FILE [ListOptions.java]

nameclass, %method, %block, %line, %
ListOptions.java100% (2/2)67%  (10/15)74%  (90/122)78%  (20.3/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ListOptions100% (1/1)60%  (6/10)67%  (59/88)71%  (12.8/18)
getIncludeMetadata (): boolean 0%   (0/1)0%   (0/6)0%   (0/1)
getMarker (): String 0%   (0/1)0%   (0/4)0%   (0/1)
getMaxResults (): Integer 0%   (0/1)0%   (0/13)0%   (0/2)
getPrefix (): String 0%   (0/1)0%   (0/4)0%   (0/1)
maxResults (int): ListOptions 100% (1/1)92%  (22/24)96%  (3.8/4)
<static initializer> 100% (1/1)100% (5/5)100% (1/1)
ListOptions (): void 100% (1/1)100% (3/3)100% (2/2)
includeMetadata (): ListOptions 100% (1/1)100% (9/9)100% (2/2)
marker (String): ListOptions 100% (1/1)100% (10/10)100% (2/2)
prefix (String): ListOptions 100% (1/1)100% (10/10)100% (2/2)
     
class ListOptions$Builder100% (1/1)80%  (4/5)91%  (31/34)89%  (8/9)
ListOptions$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
includeMetadata (): ListOptions 100% (1/1)100% (7/7)100% (2/2)
marker (String): ListOptions 100% (1/1)100% (8/8)100% (2/2)
maxResults (int): ListOptions 100% (1/1)100% (8/8)100% (2/2)
prefix (String): ListOptions 100% (1/1)100% (8/8)100% (2/2)

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.azure.storage.options;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22import static com.google.common.base.Preconditions.checkState;
23 
24import org.jclouds.http.options.BaseHttpRequestOptions;
25 
26import com.google.common.collect.ImmutableSet;
27 
28/**
29 * Options used to control paginated results (aka list commands).
30 * 
31 * @see <a href="http://msdn.microsoft.com/en-us/library/dd179466.aspx" />
32 * @author Adrian Cole
33 */
34public class ListOptions extends BaseHttpRequestOptions {
35   public static final ListOptions NONE = new ListOptions();
36 
37   /**
38    * Include this parameter to specify that the container's metadata be returned as part of the
39    * response body.
40    * 
41    * Note that metadata requested with this parameter must be stored in accordance with the naming
42    * restrictions imposed by the 2009-09-19 version of the Blob service. Beginning with this
43    * version, all metadata names must adhere to the naming conventions for C# identifiers.
44    */
45   public ListOptions includeMetadata() {
46      this.queryParameters.replaceValues("include", ImmutableSet.of("metadata"));
47      return this;
48   }
49 
50   public boolean getIncludeMetadata() {
51      return getFirstQueryOrNull("include").equals("metadata");
52   }
53 
54   /**
55    * Filters the results to return only objects whose name begins with the specified prefix.
56    */
57   public ListOptions prefix(String prefix) {
58      this.queryParameters.put("prefix", checkNotNull(prefix, "prefix"));
59      return this;
60   }
61 
62   public String getPrefix() {
63      return getFirstQueryOrNull("prefix");
64   }
65 
66   /**
67    * A string value that identifies the portion of the list to be returned with the next list
68    * operation. The operation returns a marker value within the response body if the list returned
69    * was not complete. The marker value may then be used in a subsequent call to request the next
70    * set of list items.
71    * <p/>
72    * The marker value is opaque to the client.
73    */
74   public ListOptions marker(String marker) {
75      this.queryParameters.put("marker", checkNotNull(marker, "marker"));
76      return this;
77   }
78 
79   public String getMarker() {
80      return getFirstQueryOrNull("marker");
81   }
82 
83   /**
84    * Specifies the maximum number of containers to return. If maxresults is not specified, the
85    * server will return up to 5,000 items. If the parameter is set to a value greater than 5,000,
86    * the server will return a Bad Request (400) error
87    */
88   public ListOptions maxResults(int maxresults) {
89      checkState(maxresults >= 0, "maxresults must be >= 0");
90      checkState(maxresults <= 10000, "maxresults must be <= 5000");
91      queryParameters.put("maxresults", Integer.toString(maxresults));
92      return this;
93   }
94 
95   public Integer getMaxResults() {
96      String maxresults = getFirstQueryOrNull("maxresults");
97      return (maxresults != null) ? new Integer(maxresults) : null;
98   }
99 
100   public static class Builder {
101      /**
102       * @see ListOptions#includeMetadata()
103       */
104      public static ListOptions includeMetadata() {
105         ListOptions options = new ListOptions();
106         return options.includeMetadata();
107      }
108 
109      /**
110       * @see ListOptions#prefix(String)
111       */
112      public static ListOptions prefix(String prefix) {
113         ListOptions options = new ListOptions();
114         return options.prefix(prefix);
115      }
116 
117      /**
118       * @see ListOptions#marker(String)
119       */
120      public static ListOptions marker(String marker) {
121         ListOptions options = new ListOptions();
122         return options.marker(marker);
123      }
124 
125      /**
126       * @see ListOptions#maxResults(long)
127       */
128      public static ListOptions maxResults(int maxKeys) {
129         ListOptions options = new ListOptions();
130         return options.maxResults(maxKeys);
131      }
132 
133   }
134}

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