blob: 93d18e5eb3f88f05c05e3e592dd1b27f8c260ea1 [file] [log] [blame]
Carsten Ziegeler5de92da2009-03-31 17:12:40 +00001/*
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 Ziegelerba751bd2009-04-18 18:31:43 +000019package org.apache.felix.scr.annotations;
Carsten Ziegeler5de92da2009-03-31 17:12:40 +000020
21/**
22 * Options for {@link Reference#cardinality()} property.
23 */
24public enum ReferenceCardinality {
25
26 /**
Carsten Ziegeler27764de2009-04-16 09:39:33 +000027 * 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 Ziegeler5de92da2009-03-31 17:12:40 +000030 */
Carsten Ziegeler27764de2009-04-16 09:39:33 +000031 OPTIONAL_UNARY("0..1"),
Carsten Ziegeler5de92da2009-03-31 17:12:40 +000032
33 /**
Carsten Ziegeler27764de2009-04-16 09:39:33 +000034 * 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 Ziegeler5de92da2009-03-31 17:12:40 +000037 */
Carsten Ziegeler27764de2009-04-16 09:39:33 +000038 MANDATORY_UNARY("1..1"),
Carsten Ziegeler5de92da2009-03-31 17:12:40 +000039
40 /**
Carsten Ziegeler27764de2009-04-16 09:39:33 +000041 * 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 Ziegeler5de92da2009-03-31 17:12:40 +000044 */
Carsten Ziegeler27764de2009-04-16 09:39:33 +000045 OPTIONAL_MULTIPLE("0..n"),
Carsten Ziegeler5de92da2009-03-31 17:12:40 +000046
47 /**
Carsten Ziegeler27764de2009-04-16 09:39:33 +000048 * 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 Ziegeler5de92da2009-03-31 17:12:40 +000051 */
Carsten Ziegeler27764de2009-04-16 09:39:33 +000052 MANDATORY_MULTIPLE("1..n");
Carsten Ziegeler5de92da2009-03-31 17:12:40 +000053
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}