Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
Carsten Ziegeler | ba751bd | 2009-04-18 18:31:43 +0000 | [diff] [blame] | 19 | package org.apache.felix.scr.annotations; |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 20 | |
| 21 | /** |
| 22 | * Options for {@link Reference#cardinality()} property. |
| 23 | */ |
| 24 | public enum ReferenceCardinality { |
| 25 | |
| 26 | /** |
Carsten Ziegeler | 27764de | 2009-04-16 09:39:33 +0000 | [diff] [blame] | 27 | * Optional, unary reference: No service required to be available for the |
| 28 | * refernce to be satisfied. Only a single service is available through this |
| 29 | * reference. |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 30 | */ |
Carsten Ziegeler | 27764de | 2009-04-16 09:39:33 +0000 | [diff] [blame] | 31 | OPTIONAL_UNARY("0..1"), |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 32 | |
| 33 | /** |
Carsten Ziegeler | 27764de | 2009-04-16 09:39:33 +0000 | [diff] [blame] | 34 | * Mandatory, unary reference: At least one service must be available for |
| 35 | * the reference to be satisfied. Only a single service is available through |
| 36 | * this reference. |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 37 | */ |
Carsten Ziegeler | 27764de | 2009-04-16 09:39:33 +0000 | [diff] [blame] | 38 | MANDATORY_UNARY("1..1"), |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 39 | |
| 40 | /** |
Carsten Ziegeler | 27764de | 2009-04-16 09:39:33 +0000 | [diff] [blame] | 41 | * Optional, multiple reference: No service required to be available for the |
| 42 | * refernce to be satisfied. All matching services are available through |
| 43 | * this reference. |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 44 | */ |
Carsten Ziegeler | 27764de | 2009-04-16 09:39:33 +0000 | [diff] [blame] | 45 | OPTIONAL_MULTIPLE("0..n"), |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 46 | |
| 47 | /** |
Carsten Ziegeler | 27764de | 2009-04-16 09:39:33 +0000 | [diff] [blame] | 48 | * Mandatory, multiple reference: At least one service must be available for |
| 49 | * the reference to be satisified. All matching services are available |
| 50 | * through this reference. |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 51 | */ |
Carsten Ziegeler | 27764de | 2009-04-16 09:39:33 +0000 | [diff] [blame] | 52 | MANDATORY_MULTIPLE("1..n"); |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 53 | |
| 54 | private final String cardinalityString; |
| 55 | |
| 56 | private ReferenceCardinality(final String cardinalityString) { |
| 57 | this.cardinalityString = cardinalityString; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * @return String representation of cardinality |
| 62 | */ |
| 63 | public String getCardinalityString() { |
| 64 | return this.cardinalityString; |
| 65 | } |
| 66 | |
| 67 | } |