Simon Hunt | cda9c03 | 2016-04-11 10:32:54 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Simon Hunt | cda9c03 | 2016-04-11 10:32:54 -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 | /** |
| 20 | * Abstract base class of all elements in the UI topology model. |
| 21 | */ |
Simon Hunt | 642bc45 | 2016-05-04 19:34:45 -0700 | [diff] [blame] | 22 | public abstract class UiElement { |
Simon Hunt | 23fb135 | 2016-04-11 12:15:19 -0700 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * Removes all external references, and prepares the instance for |
| 26 | * garbage collection. This default implementation does nothing. |
| 27 | */ |
| 28 | protected void destroy() { |
| 29 | // does nothing |
| 30 | } |
Simon Hunt | 642bc45 | 2016-05-04 19:34:45 -0700 | [diff] [blame] | 31 | |
| 32 | /** |
| 33 | * Returns a string representation of the element identifier. |
| 34 | * |
| 35 | * @return the element unique identifier |
| 36 | */ |
| 37 | public abstract String idAsString(); |
Simon Hunt | c0f20c1 | 2016-05-09 09:30:20 -0700 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * Returns a friendly name to be used for display purposes. |
| 41 | * This default implementation returns the result of calling |
| 42 | * {@link #idAsString()}. |
| 43 | * |
| 44 | * @return the friendly name |
| 45 | */ |
| 46 | public String name() { |
| 47 | return idAsString(); |
| 48 | } |
Simon Hunt | cda9c03 | 2016-04-11 10:32:54 -0700 | [diff] [blame] | 49 | } |