View Javadoc

1   package net.sf.mavenhist.persistency;
2   
3   import java.math.BigDecimal;
4   import java.util.Date;
5   
6   import org.apache.commons.lang.builder.ToStringBuilder;
7   
8   /**
9    * Metric defines a single metric instance.
10   */
11  public class Metric {
12    /** name of the metric. */
13    private String metricName;
14    /** value of the metric. */
15    private BigDecimal metricValue;
16    /** date of the metric. */
17    private Date date;
18  
19    /** group id of the metric, e.g. project number or company name */
20    private String groupId;
21  
22    /** artifact name where the metric is built on. */
23    private String artifactName;
24  
25    /** metric scope, e.g. package, class ... */
26    private String scope;
27  
28    /** build number, e.g. to distinct branche from head or similar */
29    private String buildNumber;
30  
31    /**
32     * Default no args constructor.
33     */
34    public Metric() {
35      this(null, null, null, null, null, null, null);
36    }
37  
38    /**
39     * Creates a new metric.
40     * 
41     * @param metricName
42     *          name
43     * @param metricValue
44     *          value
45     * @param date
46     *          date
47     * @param groupId
48     *          group id
49     * @param artifactName
50     *          artifcat name
51     * @param scope
52     *          scope
53     * @param buildNumber
54     *          build number
55     */
56    public Metric(final String metricName, final BigDecimal metricValue, final Date date,
57        final String groupId, final String artifactName, final String scope,
58        final String buildNumber) {
59      this.metricName = metricName;
60      this.metricValue = metricValue;
61      this.date = date;
62      this.groupId = groupId;
63      this.artifactName = artifactName;
64      this.scope = scope;
65      this.buildNumber = buildNumber;
66    }
67  
68    /**
69     * Gets artifactName.
70     * 
71     * @return artifactName
72     */
73    public String getArtifactName() {
74      return artifactName;
75    }
76  
77    /**
78     * Sets artifactName.
79     * 
80     * @param artifactName
81     *          artifactName to set
82     */
83    public void setArtifactName(final String artifactName) {
84      this.artifactName = artifactName;
85    }
86  
87    /**
88     * Gets buildNumber.
89     * 
90     * @return buildNumber
91     */
92    public String getBuildNumber() {
93      return buildNumber;
94    }
95  
96    /**
97     * Sets buildNumber.
98     * 
99     * @param buildNumber
100    *          buildNumber to set
101    */
102   public void setBuildNumber(final String buildNumber) {
103     this.buildNumber = buildNumber;
104   }
105 
106   /**
107    * Gets date.
108    * 
109    * @return date
110    */
111   public Date getDate() {
112     return date;
113   }
114 
115   /**
116    * Sets date.
117    * 
118    * @param date
119    *          date to set
120    */
121   public void setDate(final Date date) {
122     this.date = date;
123   }
124 
125   /**
126    * Gets groupId.
127    * 
128    * @return groupId
129    */
130   public String getGroupId() {
131     return groupId;
132   }
133 
134   /**
135    * Sets groupId.
136    * 
137    * @param groupId
138    *          groupId to set
139    */
140   public void setGroupId(final String groupId) {
141     this.groupId = groupId;
142   }
143 
144   /**
145    * Gets metricName.
146    * 
147    * @return metricName
148    */
149   public String getMetricName() {
150     return metricName;
151   }
152 
153   /**
154    * Sets metricName.
155    * 
156    * @param metricName
157    *          metricName to set
158    */
159   public void setMetricName(final String metricName) {
160     this.metricName = metricName;
161   }
162 
163   /**
164    * Gets metricValue.
165    * 
166    * @return metricValue
167    */
168   public BigDecimal getMetricValue() {
169     return metricValue;
170   }
171 
172   /**
173    * Sets metricValue.
174    * 
175    * @param metricValue
176    *          metricValue to set
177    */
178   public void setMetricValue(final BigDecimal metricValue) {
179     this.metricValue = metricValue;
180   }
181 
182   /**
183    * Gets scope.
184    * 
185    * @return scope
186    */
187   public String getScope() {
188     return scope;
189   }
190 
191   /**
192    * Sets scope.
193    * 
194    * @param scope
195    *          scope to set
196    */
197   public void setScope(final String scope) {
198     this.scope = scope;
199   }
200 
201   /**
202    * {@inheritDoc}
203    */
204   public String toString() {
205     return ToStringBuilder.reflectionToString(this);
206   }
207 }