Stuart McCulloch | 26e7a5a | 2011-10-17 10:31:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) OSGi Alliance (2011). All Rights Reserved. |
| 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.osgi.service.component.annotations; |
| 18 | |
| 19 | /** |
| 20 | * Cardinality for the {@link Reference} annotation. |
| 21 | * |
| 22 | * <p> |
| 23 | * Specifies if the reference is optional and if the component implementation |
| 24 | * support a single bound service or multiple bound services. |
| 25 | * |
| 26 | * @version $Id$ |
| 27 | */ |
| 28 | public enum ReferenceCardinality { |
| 29 | /** |
| 30 | * The reference is optional and unary. That is, the reference has a |
| 31 | * cardinality of {@code 0..1}. |
| 32 | */ |
| 33 | OPTIONAL, // 0..1 |
| 34 | /** |
| 35 | * The reference is mandatory and unary. That is, the reference has a |
| 36 | * cardinality of {@code 1..1}. |
| 37 | */ |
| 38 | MANDATORY, // 1..1 |
| 39 | /** |
| 40 | * The reference is optional and multiple. That is, the reference has a |
| 41 | * cardinality of {@code 0..n}. |
| 42 | */ |
| 43 | MULTIPLE, // 0..n |
| 44 | /** |
| 45 | * The reference is mandatory and multiple. That is, the reference has a |
| 46 | * cardinality of {@code 1..n}. |
| 47 | */ |
| 48 | AT_LEAST_ONE; // 1..n |
| 49 | } |