01: package com.jamonapi;
02:
03: import java.util.List;
04: import com.jamonapi.utils.*;
05:
06: /** Used in MonKeys. Pass a generalized form to the summaryLabel and a specific form to the
07: * detailLabel. (i.e. summary=myproc ?,?, detail=myproc 'steve','souza'. Make sure you
08: * don't pass the arguments in the wrong order as jamon uses the summary label for jamon aggregate
09: * stats, and you don't want every non-generalized form to become a jamon record.
10: *
11: * @author steve souza
12: *
13: */
14: public class MonKeyItemBase implements MonKeyItem {
15: private Object summaryLabel;
16: private Object details;
17:
18: public MonKeyItemBase(Object summaryLabel) {
19: this .summaryLabel = (summaryLabel == null) ? "" : summaryLabel;
20: this .details = (summaryLabel == null) ? "" : summaryLabel;
21: }
22:
23: public MonKeyItemBase(Object summaryLabel, Object details) {
24: this .summaryLabel = (summaryLabel == null) ? "" : summaryLabel;
25: this .details = details;
26: }
27:
28: public Object getDetails() {
29: return details;
30: }
31:
32: public void setDetails(Object details) {
33: this .details = details;
34: }
35:
36: // public List getDetails(List list) {
37: // Misc.addTo(list, details);
38: // return list;
39: //
40: // }
41:
42: /** should call getSummaryLabel */
43: public String toString() {
44: return summaryLabel.toString();
45: }
46:
47: public boolean equals(Object obj) {
48: if (this == obj)
49: return true;
50: else if (obj == null)
51: return false;
52: else if (!(obj instanceof MonKeyItemBase))
53: return false;
54: else {
55: MonKeyItemBase mk = (MonKeyItemBase) obj;
56: return summaryLabel.equals(mk.summaryLabel);
57: }
58: }
59:
60: public int hashCode() {
61: return summaryLabel.hashCode();
62: }
63:
64: }
|