EMMA Coverage Report (generated Wed Aug 10 12:30:04 EDT 2011)
[all classes][org.jclouds.openstack.nova.domain]

COVERAGE SUMMARY FOR SOURCE FILE [Address.java]

nameclass, %method, %block, %line, %
Address.java100% (3/3)93%  (13/14)86%  (96/112)90%  (20.7/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Address100% (1/1)90%  (9/10)84%  (84/100)89%  (18.7/21)
getVersion (): int 0%   (0/1)0%   (0/3)0%   (0/1)
equals (Object): boolean 100% (1/1)71%  (29/41)80%  (4.8/6)
hashCode (): int 100% (1/1)94%  (17/18)98%  (2.9/3)
Address (): void 100% (1/1)100% (3/3)100% (2/2)
Address (String, int): void 100% (1/1)100% (9/9)100% (4/4)
getAddress (): String 100% (1/1)100% (3/3)100% (1/1)
newAddress2StringFunction (): Function 100% (1/1)100% (4/4)100% (1/1)
newString2AddressFunction (): Function 100% (1/1)100% (4/4)100% (1/1)
toString (): String 100% (1/1)100% (3/3)100% (1/1)
valueOf (String): Address 100% (1/1)100% (12/12)100% (1/1)
     
class Address$1100% (1/1)100% (2/2)100% (6/6)100% (2/2)
Address$1 (): void 100% (1/1)100% (3/3)100% (1/1)
apply (Address): String 100% (1/1)100% (3/3)100% (1/1)
     
class Address$2100% (1/1)100% (2/2)100% (6/6)100% (2/2)
Address$2 (): void 100% (1/1)100% (3/3)100% (1/1)
apply (String): Address 100% (1/1)100% (3/3)100% (1/1)

1/**
2 *
3 * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4 *
5 * ====================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * 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, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ====================================================================
18 */
19package org.jclouds.openstack.nova.domain;
20 
21import com.google.common.base.Function;
22import com.google.gson.annotations.SerializedName;
23 
24import javax.annotation.Nullable;
25 
26/**
27 * @author Dmitri Babaev
28 */
29public class Address {
30   @SerializedName("addr")
31   private String address;
32   private int version;
33 
34   //for de-serialization
35   @SuppressWarnings("unused")
36   private Address() {
37   }
38 
39   public Address(String address, int version) {
40      this.address = address;
41      this.version = version;
42   }
43 
44   public String getAddress() {
45      return address;
46   }
47 
48   public int getVersion() {
49      return version;
50   }
51 
52   @Override
53   public String toString() {
54      return address;
55   }
56 
57   @Override
58   public boolean equals(Object o) {
59      if (this == o) return true;
60      if (o == null || getClass() != o.getClass()) return false;
61 
62      Address address1 = (Address) o;
63 
64      if (version != address1.version) return false;
65      if (address != null ? !address.equals(address1.address) : address1.address != null) return false;
66 
67      return true;
68   }
69 
70   @Override
71   public int hashCode() {
72      int result = address != null ? address.hashCode() : 0;
73      result = 31 * result + version;
74      return result;
75   }
76 
77   public static Function<Address, String> newAddress2StringFunction() {
78      return new Function<Address, String>() {
79         @Override
80         public String apply(@Nullable Address input) {
81            return input.getAddress();
82         }
83      };
84   }
85 
86   public static Address valueOf(String address) {
87      return new Address(address, address.startsWith("::") ? 6 : 4);
88   }
89 
90   public static Function<String, Address> newString2AddressFunction() {
91      return new Function<String, Address>() {
92         @Override
93         public Address apply(@Nullable String input) {
94            return valueOf(input);
95         }
96      };
97   }
98}

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