blob: e3e0cc1b81c72793672ad743ccea7c32690f57b4 [file] [log] [blame]
pierventre30368ab2021-02-24 23:23:22 +01001/*
2 * Copyright 2021-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 */
16package org.onosproject.segmentrouting.policy.api;
17
18import org.onlab.util.Identifier;
19
20import static com.google.common.base.Preconditions.checkArgument;
21import static com.google.common.base.Preconditions.checkNotNull;
22
23/**
24 * Representation of a policy id.
25 */
26public final class PolicyId extends Identifier<String> {
27
28 protected PolicyId(String id) {
29 super(id);
30 }
31
32 /**
33 * Returns the id of the policy given the value.
34 *
35 * @param name policy id value
36 * @return policy id
37 */
38 public static PolicyId of(String name) {
39 checkNotNull(name);
40 checkArgument(!name.isEmpty(), "Name cannot be empty");
41 return new PolicyId(name);
42 }
43
44}