d0f03959098a6bd73f84816ca91ec5e917292b5d
[onosfw.git] /
1 /*
2  * Copyright 2015 Open Networking Laboratory
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.onosproject.vtnrsc.sfc;
17
18 import java.util.Objects;
19 import java.util.UUID;
20 import com.google.common.base.MoreObjects;
21
22 /**
23  * flow classification identifier.
24  */
25 public final class FlowClassifierId {
26
27     private final UUID flowClassifierId;
28
29     /**
30      * Constructor to create flow classifier id.
31      *
32      * @param flowClassifierId flow classifier id.
33      */
34     private FlowClassifierId(final UUID flowClassifierId) {
35         this.flowClassifierId = flowClassifierId;
36     }
37
38     /**
39      * Returns new flow classifier id.
40      *
41      * @param flowClassifierId flow classifier id
42      * @return new flow classifier id
43      */
44     public static FlowClassifierId flowClassifierId(final UUID flowClassifierId) {
45         return new FlowClassifierId(flowClassifierId);
46     }
47
48     @Override
49     public int hashCode() {
50         return Objects.hashCode(this.flowClassifierId);
51     }
52
53     @Override
54     public boolean equals(Object obj) {
55         if (this == obj) {
56             return true;
57         }
58         if (obj instanceof FlowClassifierId) {
59             final FlowClassifierId other = (FlowClassifierId) obj;
60             return Objects.equals(this.flowClassifierId, other.flowClassifierId);
61         }
62         return false;
63     }
64
65     @Override
66     public String toString() {
67         return MoreObjects.toStringHelper(getClass())
68                 .add("FlowClassifierId", flowClassifierId)
69                 .toString();
70     }
71 }