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

COVERAGE SUMMARY FOR SOURCE FILE [OperatingSystemSection.java]

nameclass, %method, %block, %line, %
OperatingSystemSection.java100% (2/2)67%  (10/15)34%  (70/206)32%  (15/47)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OperatingSystemSection100% (1/1)62%  (5/8)25%  (40/158)21%  (8/38)
equals (Object): boolean 0%   (0/1)0%   (0/69)0%   (0/23)
hashCode (): int 0%   (0/1)0%   (0/45)0%   (0/6)
toBuilder (): OperatingSystemSection$Builder 0%   (0/1)0%   (0/4)0%   (0/1)
OperatingSystemSection (Integer, String, String): void 100% (1/1)100% (10/10)100% (4/4)
builder (): OperatingSystemSection$Builder 100% (1/1)100% (4/4)100% (1/1)
getDescription (): String 100% (1/1)100% (3/3)100% (1/1)
getId (): Integer 100% (1/1)100% (3/3)100% (1/1)
toString (): String 100% (1/1)100% (20/20)100% (1/1)
     
class OperatingSystemSection$Builder100% (1/1)71%  (5/7)62%  (30/48)78%  (7/9)
fromOperatingSystemSection (OperatingSystemSection): OperatingSystemSection$B... 0%   (0/1)0%   (0/11)0%   (0/1)
fromSection (Section): OperatingSystemSection$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
OperatingSystemSection$Builder (): void 100% (1/1)100% (3/3)100% (1/1)
build (): OperatingSystemSection 100% (1/1)100% (10/10)100% (1/1)
description (String): OperatingSystemSection$Builder 100% (1/1)100% (5/5)100% (2/2)
id (Integer): OperatingSystemSection$Builder 100% (1/1)100% (5/5)100% (2/2)
info (String): OperatingSystemSection$Builder 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.ovf;
20 
21import org.jclouds.javax.annotation.Nullable;
22 
23import org.jclouds.cim.OSType;
24 
25/**
26 * An OperatingSystemSection specifies the operating system installed on a virtual machine.
27 * 
28 * @author Adrian Cole
29 */
30public class OperatingSystemSection extends Section<OperatingSystemSection> {
31 
32   @SuppressWarnings("unchecked")
33   public static Builder builder() {
34      return new Builder();
35   }
36 
37   /**
38    * {@inheritDoc}
39    */
40   @Override
41   public Builder toBuilder() {
42      return builder().fromOperatingSystemSection(this);
43   }
44 
45   public static class Builder extends Section.Builder<OperatingSystemSection> {
46      protected Integer id;
47      protected String description;
48 
49      /**
50       * @see OperatingSystemSection#getID
51       */
52      public Builder id(Integer id) {
53         this.id = id;
54         return this;
55      }
56 
57      /**
58       * @see OperatingSystemSection#getDescription
59       */
60      public Builder description(String description) {
61         this.description = description;
62         return this;
63      }
64 
65      /**
66       * {@inheritDoc}
67       */
68      @Override
69      public OperatingSystemSection build() {
70         return new OperatingSystemSection(id, info, description);
71      }
72 
73      public Builder fromOperatingSystemSection(OperatingSystemSection in) {
74         return id(in.getId()).info(in.getInfo()).description(in.getDescription());
75      }
76 
77      /**
78       * {@inheritDoc}
79       */
80      @Override
81      public Builder fromSection(Section<OperatingSystemSection> in) {
82         return Builder.class.cast(super.fromSection(in));
83      }
84 
85      /**
86       * {@inheritDoc}
87       */
88      @Override
89      public Builder info(String info) {
90         return Builder.class.cast(super.info(info));
91      }
92 
93   }
94 
95   protected final Integer id;
96   protected final String description;
97 
98   public OperatingSystemSection(@Nullable Integer id, @Nullable String info, @Nullable String description) {
99      super(info);
100      this.id = id;
101      this.description = description;
102   }
103 
104   /**
105    * 
106    * @return ovf id
107    * @see OSType#getCode()
108    */
109   public Integer getId() {
110      return id;
111   }
112 
113   /**
114    * 
115    * @return description or null
116    */
117   public String getDescription() {
118      return description;
119   }
120 
121   @Override
122   public int hashCode() {
123      final int prime = 31;
124      int result = 1;
125      result = prime * result + ((description == null) ? 0 : description.hashCode());
126      result = prime * result + ((id == null) ? 0 : id.hashCode());
127      result = prime * result + ((info == null) ? 0 : info.hashCode());
128      return result;
129   }
130 
131   @Override
132   public boolean equals(Object obj) {
133      if (this == obj)
134         return true;
135      if (obj == null)
136         return false;
137      if (getClass() != obj.getClass())
138         return false;
139      OperatingSystemSection other = (OperatingSystemSection) obj;
140      if (description == null) {
141         if (other.description != null)
142            return false;
143      } else if (!description.equals(other.description))
144         return false;
145      if (id == null) {
146         if (other.id != null)
147            return false;
148      } else if (!id.equals(other.id))
149         return false;
150      if (info == null) {
151         if (other.info != null)
152            return false;
153      } else if (!info.equals(other.info))
154         return false;
155      return true;
156   }
157 
158   @Override
159   public String toString() {
160      return String.format("[info=%s, id=%s, description=%s]", info, id, description);
161   }
162 
163}

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