EMMA Coverage Report (generated Wed Oct 26 13:47:17 EDT 2011)
[all classes][org.jclouds.compute.domain]

COVERAGE SUMMARY FOR SOURCE FILE [ComputeMetadataBuilder.java]

nameclass, %method, %block, %line, %
ComputeMetadataBuilder.java100% (1/1)82%  (9/11)61%  (69/113)88%  (15/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ComputeMetadataBuilder100% (1/1)82%  (9/11)61%  (69/113)88%  (15/17)
build (): ComputeMetadata 0%   (0/1)0%   (0/20)0%   (0/1)
fromComputeMetadata (ComputeMetadata): ComputeMetadataBuilder 0%   (0/1)0%   (0/24)0%   (0/1)
ComputeMetadataBuilder (ComputeType): void 100% (1/1)100% (12/12)100% (4/4)
id (String): ComputeMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
ids (String): ComputeMetadataBuilder 100% (1/1)100% (8/8)100% (2/2)
location (Location): ComputeMetadataBuilder 100% (1/1)100% (7/7)100% (1/1)
name (String): ComputeMetadataBuilder 100% (1/1)100% (7/7)100% (1/1)
providerId (String): ComputeMetadataBuilder 100% (1/1)100% (7/7)100% (1/1)
tags (Iterable): ComputeMetadataBuilder 100% (1/1)100% (9/9)100% (2/2)
uri (URI): ComputeMetadataBuilder 100% (1/1)100% (7/7)100% (1/1)
userMetadata (Map): ComputeMetadataBuilder 100% (1/1)100% (7/7)100% (1/1)

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.compute.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.net.URI;
24import java.util.Map;
25import java.util.Set;
26 
27import org.jclouds.compute.domain.internal.ComputeMetadataImpl;
28import org.jclouds.domain.Location;
29import org.jclouds.domain.ResourceMetadataBuilder;
30 
31import com.google.common.collect.ImmutableSet;
32 
33/**
34 * 
35 * @author Adrian Cole
36 */
37public class ComputeMetadataBuilder extends ResourceMetadataBuilder<ComputeType> {
38   protected String id;
39   protected ComputeType type;
40   protected Set<String> tags = ImmutableSet.<String>of();
41 
42   public ComputeMetadataBuilder(ComputeType type) {
43      this.type = checkNotNull(type, "type");
44   }
45 
46   public ComputeMetadataBuilder id(String id) {
47      this.id = id;
48      return this;
49   }
50 
51   public ComputeMetadataBuilder tags(Iterable<String> tags) {
52      this.tags  = ImmutableSet.<String> copyOf(checkNotNull(tags, "tags"));
53      return this;
54   }
55 
56   /**
57    * set id and providerId to the same value;
58    */
59   public ComputeMetadataBuilder ids(String id) {
60      id(id).providerId(id);
61      return this;
62   }
63 
64   @Override
65   public ComputeMetadataBuilder providerId(String providerId) {
66      return ComputeMetadataBuilder.class.cast(super.providerId(providerId));
67   }
68 
69   @Override
70   public ComputeMetadataBuilder name(String name) {
71      return ComputeMetadataBuilder.class.cast(super.name(name));
72   }
73 
74   @Override
75   public ComputeMetadataBuilder location(Location location) {
76      return ComputeMetadataBuilder.class.cast(super.location(location));
77   }
78 
79   @Override
80   public ComputeMetadataBuilder uri(URI uri) {
81      return ComputeMetadataBuilder.class.cast(super.uri(uri));
82   }
83 
84   @Override
85   public ComputeMetadataBuilder userMetadata(Map<String, String> userMetadata) {
86      return ComputeMetadataBuilder.class.cast(super.userMetadata(userMetadata));
87   }
88 
89   public ComputeMetadata build() {
90      return new ComputeMetadataImpl(type, providerId, name, id, location, uri, userMetadata, tags);
91   }
92 
93   public static ComputeMetadataBuilder fromComputeMetadata(ComputeMetadata in) {
94      return new ComputeMetadataBuilder(in.getType()).id(in.getId()).location(in.getLocation()).name(in.getName())
95            .uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags());
96   }
97}

[all classes][org.jclouds.compute.domain]
EMMA 2.0.5312 (C) Vladimir Roubtsov