blob: 15804ff50fc655206ccf82dfda2daecf52031255 [file] [log] [blame]
Thomas Vachuska7b3fe3a2016-02-01 11:26:22 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Thomas Vachuska7b3fe3a2016-02-01 11:26:22 -08003 *
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.net.driver;
18
19import com.google.common.annotations.Beta;
20
21/**
22 * Abstraction of an entity capable of being projected as another entity.
23 */
24@Beta
25public 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
Thomas Vachuskae3ea9a42016-02-10 17:54:59 -080033 * @return projection instance
34 * @throws IllegalStateException if a driver cannot be found
35 * @throws IllegalArgumentException if the projection is not supported
Thomas Vachuska7b3fe3a2016-02-01 11:26:22 -080036 */
37 <B extends Behaviour> B as(Class<B> projectionClass);
38
39 /**
40 * Returns true if this entity is capable of being projected as the
41 * specified class.
42 *
Thomas Vachuska3afbc7f2016-02-01 15:55:38 -080043 * @param projectionClass requested projection class
Thomas Vachuska7b3fe3a2016-02-01 11:26:22 -080044 * @param <B> type of behaviour
45 * @return true if the requested projection is supported
46 */
47 <B extends Behaviour> boolean is(Class<B> projectionClass);
48
49}