Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 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 | |
| 17 | package org.onosproject.ui.model.topo; |
| 18 | |
| 19 | import org.onlab.util.Identifier; |
| 20 | |
| 21 | /** |
| 22 | * Identifier of a topology layout. |
| 23 | */ |
| 24 | public final class UiTopoLayoutId extends Identifier<String> { |
| 25 | |
Simon Hunt | b3656d4 | 2017-04-07 18:15:35 -0700 | [diff] [blame] | 26 | private static final String DEFAULT_STR = "root"; |
Simon Hunt | b1ce260 | 2016-07-23 14:04:31 -0700 | [diff] [blame] | 27 | |
Thomas Vachuska | eb851cd | 2016-07-21 15:41:05 -0700 | [diff] [blame] | 28 | /** |
| 29 | * Default topology layout identifier. |
| 30 | */ |
Simon Hunt | b1ce260 | 2016-07-23 14:04:31 -0700 | [diff] [blame] | 31 | public static final UiTopoLayoutId DEFAULT_ID = |
| 32 | UiTopoLayoutId.layoutId(DEFAULT_STR); |
Thomas Vachuska | eb851cd | 2016-07-21 15:41:05 -0700 | [diff] [blame] | 33 | |
Thomas Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 34 | // 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 Hunt | b1ce260 | 2016-07-23 14:04:31 -0700 | [diff] [blame] | 51 | |
| 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 Vachuska | 4d66d0a | 2016-04-15 15:48:13 -0700 | [diff] [blame] | 60 | } |