blob: 7c9d1dbf01c7f0a6276261e86e1b26b43f628900 [file] [log] [blame]
Brian O'Connordee2e6b2014-08-12 11:34:51 -07001package net.onrc.onos.core.matchaction;
2
Ray Milkeyc127a5a2014-08-20 11:22:12 -07003import java.util.UUID;
4
5/**
6 * Identifier for a MatchActionOperations object. This is an immutable class
7 * that encapsulates a globally unique identifier for the MatchActionOperations
8 * object.
9 */
10public final class MatchActionOperationsId {
11
12 private static final String OPERATIONS_ID_PREFIX = "MatchActionOperationsId-";
13 private final String id;
14
15 /**
16 * Constructs an Operations identifier and allocates a unique identifier
17 * for it.
18 */
19 private MatchActionOperationsId() {
20 id = OPERATIONS_ID_PREFIX + UUID.randomUUID();
21 }
22
23 /**
24 * Gets the identifier for the Operations object.
25 *
26 * @return Operations object identifier as a string
27 */
28 public String getId() {
29 return id;
30 }
31
32 @Override
33 public boolean equals(final Object other) {
34 if (other == this) {
35 return true;
36 }
37
38 if (!(other instanceof MatchActionOperationsId)) {
39 return false;
40 }
41
42 final MatchActionOperationsId otherMatchActionOperationsId =
43 (MatchActionOperationsId) other;
44
45 return otherMatchActionOperationsId.getId().equals(getId());
46 }
47
48 @Override
49 public int hashCode() {
50 return id.hashCode();
51 }
52
53 /**
54 * Creates a new Id for a MatchActionOperation.
55 *
56 * @return new Id for a MatchActionOperation
57 */
58 public static MatchActionOperationsId createNewOperationsId() {
59 return new MatchActionOperationsId();
60 }
61
Brian O'Connordee2e6b2014-08-12 11:34:51 -070062}