9bccf0feb680bcf399449f3ff108275d7155dd3e
[policy/engine.git] / ECOMP-ControlloopPolicy / src / main / java / org / openecomp / policy / controlloop / policy / Target.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ECOMP Policy Engine
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.openecomp.policy.controlloop.policy;
21
22 import java.io.Serializable;
23
24 public class Target implements Serializable {
25
26         /**
27          * 
28          */
29         private static final long serialVersionUID = 2180988443264988319L;
30          
31         public String resourceID;
32         public TargetType type;
33
34         public Target() {
35                 
36         }
37         
38         public Target(TargetType type) {
39                 this.type = type;
40         }
41         
42         public Target(String resourceID) {
43                 this.resourceID = resourceID;
44         }
45         
46         public Target(TargetType type, String resourceID) {
47                 this.type = type;
48                 this.resourceID = resourceID;
49         }
50         
51         public Target(Target target) {
52                 this.type = target.type;
53                 this.resourceID = target.resourceID;
54         }
55         
56         @Override
57         public String toString() {
58                 return "Target [type=" + type + ", resourceID=" + resourceID + "]";
59         }
60         
61         @Override
62         public int hashCode() {
63                 final int prime = 31;
64                 int result = 1;
65                 result = prime * result + ((type == null) ? 0 : type.hashCode());
66                 result = prime * result + ((resourceID == null) ? 0 : resourceID.hashCode());
67                 return result;
68         }
69         @Override
70         public boolean equals(Object obj) {
71                 if (this == obj)
72                         return true;
73                 if (obj == null)
74                         return false;
75                 if (getClass() != obj.getClass())
76                         return false;
77                 Target other = (Target) obj;
78                 if (type == null) {
79                         if (other.type != null)
80                                 return false;
81                 } else if (!type.equals(other.type))
82                         return false;
83                 if (resourceID == null) {
84                         if (other.resourceID != null)
85                                 return false;
86                 } else if (!resourceID.equals(other.resourceID))
87                         return false;
88                 return true;
89         }
90 }