Thomas Vachuska | 7b3fe3a | 2016-02-01 11:26:22 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014-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 | |
| 17 | package org.onosproject.net.driver; |
| 18 | |
| 19 | import com.google.common.annotations.Beta; |
| 20 | |
| 21 | /** |
| 22 | * Abstraction of an entity capable of being projected as another entity. |
| 23 | */ |
| 24 | @Beta |
| 25 | public interface Projectable { |
| 26 | |
| 27 | /** |
| 28 | * Returns the specified projection of this entity if such projection |
| 29 | * is supported. |
| 30 | * |
| 31 | * @param projectionClass requested projection class |
| 32 | * @param <B> type of behaviour |
| 33 | * @return projection instance or null if requested projection is not supported |
| 34 | */ |
| 35 | <B extends Behaviour> B as(Class<B> projectionClass); |
| 36 | |
| 37 | /** |
| 38 | * Returns true if this entity is capable of being projected as the |
| 39 | * specified class. |
| 40 | * |
| 41 | * @param projectionClass projection class |
| 42 | * @param <B> type of behaviour |
| 43 | * @return true if the requested projection is supported |
| 44 | */ |
| 45 | <B extends Behaviour> boolean is(Class<B> projectionClass); |
| 46 | |
| 47 | } |