1 package org.lsst.ccs.config;
2
3 import org.hibernate.annotations.Immutable;
4
5 import javax.persistence.Embeddable;
6 import javax.persistence.Embedded;
7 import javax.persistence.EmbeddedId;
8 import java.io.Serializable;
9
10
11
12
13
14 @Embeddable
15 @Immutable
16 public class ParameterBase implements Serializable, PathObject {
17 private static final long serialVersionUID = -1173880414018123185L;
18
19 @Embedded
20
21 ParameterPath
22
23
24
25
26 String
27
28
29
30
31 String
32
33
34
35 ParameterBase() {}
36
37 public ParameterBase(String componentName, String codeName, String parameterName, String typeName, String defaultValue) {
38 this( new ParameterPath(componentName,codeName,parameterName), typeName, defaultValue) ;
39 }
40
41 public ParameterBase(ParameterPath path, String typeName, String defaultValue) {
42
43 this.path = path;
44 this.typeName = typeName;
45 this.defaultValue = defaultValue;
46 }
47
48
49 public String getComponentName() {
50 return path.componentName;
51 }
52
53 void setComponentName(String componentName) {
54 this.path.componentName = componentName;
55 }
56
57 public String getCodeName() {
58 return path.codeName;
59 }
60
61 void setCodeName(String codeName) {
62 this.path.codeName = codeName;
63 }
64
65 public String getParameterName() {
66 return path.parameterName;
67 }
68
69 void setParameterName(String parameterName) {
70 this.path.parameterName = parameterName;
71 }
72
73 public String getTypeName() {
74 return typeName;
75 }
76
77 void setTypeName(String typeName) {
78 this.typeName = typeName;
79 }
80
81 public String getDefaultValue() {
82 return defaultValue;
83 }
84
85 void setDefaultValue(String defaultValue) {
86 this.defaultValue = defaultValue;
87 }
88
89
90 @EmbeddedId
91 public ParameterPath getPath() {
92 return path;
93 }
94
95 void setPath(ParameterPath path) {
96 this.path = path;
97 }
98
99
100
101
102
103
104
105
106 @Override
107 public boolean equals(Object o) {
108 if (this == o) return true;
109 if (!(o instanceof PathObject)) return false;
110
111 PathObject that = (PathObject) o ;
112 if(! this.getPath().equals(that.getPath())) return false ;
113
114 return true;
115 }
116
117 @Override
118 public int hashCode() {
119 return path.hashCode() ;
120 }
121
122 @Override
123 public String toString() {
124 return "{" +
125 "path=" + path.toString() +
126 '}';
127 }
128
129 }