blob: 3dea4bbb21fb35bb81ccd8f8411a94028c30b6cd [file] [log] [blame]
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -07001/*
2 * Copyright 2016 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
17package org.onosproject.ui.model.topo;
18
19import org.onlab.util.Identifier;
20
21/**
22 * Identifier of a topology layout.
23 */
24public final class UiTopoLayoutId extends Identifier<String> {
25
Simon Huntb1ce2602016-07-23 14:04:31 -070026 private static final String DEFAULT_STR = "_default_";
27
Thomas Vachuskaeb851cd2016-07-21 15:41:05 -070028 /**
29 * Default topology layout identifier.
30 */
Simon Huntb1ce2602016-07-23 14:04:31 -070031 public static final UiTopoLayoutId DEFAULT_ID =
32 UiTopoLayoutId.layoutId(DEFAULT_STR);
Thomas Vachuskaeb851cd2016-07-21 15:41:05 -070033
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070034 // For serialization
35 private UiTopoLayoutId() {
36 }
37
38 private UiTopoLayoutId(String value) {
39 super(value);
40 }
41
42 /**
43 * Returns the layout identifier created from the specified value.
44 *
45 * @param value string value
46 * @return layout identifier
47 */
48 public static UiTopoLayoutId layoutId(String value) {
49 return new UiTopoLayoutId(value);
50 }
Simon Huntb1ce2602016-07-23 14:04:31 -070051
52 /**
53 * Returns true if this is the identifier for the default layout.
54 *
55 * @return true if this is the default layout identifier
56 */
57 public boolean isDefault() {
58 return DEFAULT_STR.equals(identifier);
59 }
Thomas Vachuska4d66d0a2016-04-15 15:48:13 -070060}