blob: b5a02acf240ac4dd2becab556d89801ceeb1b02b [file] [log] [blame]
Simon Huntcda9c032016-04-11 10:32:54 -07001/*
Brian O'Connor0a4e6742016-09-15 23:03:10 -07002 * Copyright 2016-present Open Networking Laboratory
Simon Huntcda9c032016-04-11 10:32:54 -07003 *
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
19/**
20 * Abstract base class of all elements in the UI topology model.
21 */
Simon Hunt642bc452016-05-04 19:34:45 -070022public abstract class UiElement {
Simon Hunt23fb1352016-04-11 12:15:19 -070023
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 Hunt642bc452016-05-04 19:34:45 -070031
32 /**
33 * Returns a string representation of the element identifier.
34 *
35 * @return the element unique identifier
36 */
37 public abstract String idAsString();
Simon Huntc0f20c12016-05-09 09:30:20 -070038
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 Huntcda9c032016-04-11 10:32:54 -070049}