View Javadoc

1   package org.lsst.ccs.config;
2   
3   import javax.persistence.Embeddable;
4   import java.io.Serializable;
5   
6   /**
7    * A data structure that contains name of subsystem, configuration and tag.
8    * @author bamade
9    */
10  // Date: 12/04/12
11  
12      @Embeddable
13  public  class NamesAndTag implements Serializable {
14      private static final long serialVersionUID = -3581991261638846892L;
15      public String subsystemName ;
16          public String configName ;
17          public String tag ;
18  
19  
20          NamesAndTag() {
21          }
22  
23      public NamesAndTag(String subsystemName, String configName, String tag) {
24          this.subsystemName = subsystemName;
25          if(configName == null) configName ="" ;
26          this.configName = configName;
27          if(tag == null) tag ="" ;
28          this.tag = tag;
29      }
30  
31      public String getSubsystemName() {
32          return subsystemName;
33      }
34  
35      public void setSubsystemName(String subsystemName) {
36          this.subsystemName = subsystemName;
37      }
38  
39      public String getConfigName() {
40          return configName;
41      }
42  
43      public void setConfigName(String configName) {
44          if(configName == null ) configName = "" ;
45          this.configName = configName;
46      }
47  
48      public String getTag() {
49          return tag;
50      }
51  
52      public void setTag(String tag) {
53          if(tag == null ) tag = "" ;
54          this.tag = tag;
55      }
56  
57      @Override
58      public boolean equals(Object o) {
59          if (this == o) return true;
60          if (o == null || getClass() != o.getClass()) return false;
61  
62          NamesAndTag that = (NamesAndTag) o;
63  
64          if (!configName.equals(that.configName)) return false;
65          if (!subsystemName.equals(that.subsystemName)) return false;
66          if (!tag.equals(that.tag)) return false;
67  
68          return true;
69      }
70  
71      @Override
72      public int hashCode() {
73          int result = subsystemName.hashCode();
74          result = 31 * result + configName.hashCode();
75          result = 31 * result + tag.hashCode();
76          return result;
77      }
78  
79      public String toString() {
80          return subsystemName+'_'+configName+'_'+tag ;
81      }
82  }