EMMA Coverage Report (generated Mon Oct 17 05:41:20 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 * 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.openstack.nova.domain;
20 
21import com.google.common.base.Function;
22import com.google.gson.annotations.SerializedName;
23import org.jclouds.javax.annotation.Nullable;
24 
25/**
26 * @author Dmitri Babaev
27 */
28public class Address {
29   @SerializedName("addr")
30   private String address;
31   private int version;
32 
33   //for de-serialization
34   @SuppressWarnings("unused")
35   private Address() {
36   }
37 
38   public Address(String address, int version) {
39      this.address = address;
40      this.version = version;
41   }
42 
43   public String getAddress() {
44      return address;
45   }
46 
47   public int getVersion() {
48      return version;
49   }
50 
51   @Override
52   public String toString() {
53      return address;
54   }
55 
56   @Override
57   public boolean equals(Object o) {
58      if (this == o) return true;
59      if (o == null || getClass() != o.getClass()) return false;
60 
61      Address address1 = (Address) o;
62 
63      if (version != address1.version) return false;
64      if (address != null ? !address.equals(address1.address) : address1.address != null) return false;
65 
66      return true;
67   }
68 
69   @Override
70   public int hashCode() {
71      int result = address != null ? address.hashCode() : 0;
72      result = 31 * result + version;
73      return result;
74   }
75 
76   public static Function<Address, String> newAddress2StringFunction() {
77      return new Function<Address, String>() {
78         @Override
79         public String apply(@Nullable Address input) {
80            return input.getAddress();
81         }
82      };
83   }
84 
85   public static Address valueOf(String address) {
86      return new Address(address, address.startsWith("::") ? 6 : 4);
87   }
88 
89   public static Function<String, Address> newString2AddressFunction() {
90      return new Function<String, Address>() {
91         @Override
92         public Address apply(@Nullable String input) {
93            return valueOf(input);
94         }
95      };
96   }
97}

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