blob: 9869af16fa79d1e7ac632926c67c5161d705a727 [file] [log] [blame]
Jonathan Hart612651f2019-11-25 09:21:43 -08001/*
2 * Copyright 2020-present Open Networking Foundation
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
17package org.opencord.aaa.impl;
18
19import java.util.Objects;
20
21/**
22 * An identifier for an authentication request.
23 */
24public final class RequestIdentifier {
25
26 private byte identifier;
27
28 /**
29 * Creates a new request identifier.
30 *
31 * @param identifier id number
32 */
33 private RequestIdentifier(byte identifier) {
34 this.identifier = identifier;
35 }
36
37 /**
38 * Returns the id number.
39 *
40 * @return id
41 */
42 public byte identifier() {
43 return this.identifier;
44 }
45
46 /**
47 * Creates a new request identifier.
48 *
49 * @param identifier id number
50 * @return identifier
51 */
52 public static RequestIdentifier of(byte identifier) {
53 return new RequestIdentifier(identifier);
54 }
55
56 public boolean equals(Object other) {
57 if (!(other instanceof RequestIdentifier)) {
58 return false;
59 }
60
61 RequestIdentifier that = (RequestIdentifier) other;
62
63 return identifier == that.identifier;
64 }
65
66 public int hashCode() {
67 return Objects.hashCode(identifier);
68 }
69}