blob: 3f753dd5776c05ef1d81b411f2fb96fb3844899a [file] [log] [blame]
jiangrui72d343a2015-11-11 18:00:16 +08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
jiangrui72d343a2015-11-11 18:00:16 +08003 *
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 */
16package org.onosproject.vtnrsc;
17
Jian Lid79fb942016-02-29 13:42:23 -080018import org.onlab.util.Identifier;
jiangrui72d343a2015-11-11 18:00:16 +080019
jiangrui72d343a2015-11-11 18:00:16 +080020import java.util.UUID;
21
Jian Lid79fb942016-02-29 13:42:23 -080022import static com.google.common.base.Preconditions.checkNotNull;
23
jiangrui72d343a2015-11-11 18:00:16 +080024/**
25 * Immutable representation of a floating IP identifier.
26 */
Jian Lid79fb942016-02-29 13:42:23 -080027public final class FloatingIpId extends Identifier<UUID> {
jiangrui72d343a2015-11-11 18:00:16 +080028 // Public construction is prohibited
29 private FloatingIpId(UUID floatingIpId) {
Jian Lid79fb942016-02-29 13:42:23 -080030 super(checkNotNull(floatingIpId, "floatingIpId cannot be null"));
jiangrui72d343a2015-11-11 18:00:16 +080031 }
32
33 /**
34 * Creates a floating IP identifier.
35 *
36 * @param floatingIpId the UUID id of floating IP identifier
37 * @return object of floating IP identifier
38 */
39 public static FloatingIpId of(UUID floatingIpId) {
40 return new FloatingIpId(floatingIpId);
41 }
42
43 /**
44 * Creates a floating IP identifier.
45 *
46 * @param floatingIpId the floating IP identifier in string
47 * @return object of floating IP identifier
48 */
49 public static FloatingIpId of(String floatingIpId) {
50 return new FloatingIpId(UUID.fromString(floatingIpId));
51 }
52
53 /**
54 * Returns the floating IP identifier.
55 *
56 * @return the floating IP identifier
57 */
58 public UUID floatingIpId() {
Jian Lid79fb942016-02-29 13:42:23 -080059 return identifier;
jiangrui72d343a2015-11-11 18:00:16 +080060 }
61}