OSGi™ Compendium
Release 5

org.osgi.service.component.annotations
Enum ReferenceCardinality

java.lang.Object
  extended by java.lang.Enum<ReferenceCardinality>
      extended by org.osgi.service.component.annotations.ReferenceCardinality
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ReferenceCardinality>

public enum ReferenceCardinality
extends java.lang.Enum<ReferenceCardinality>

Cardinality for the Reference annotation.

Specifies if the reference is optional and if the component implementation support a single bound service or multiple bound services.


Enum Constant Summary
AT_LEAST_ONE
          The reference is mandatory and multiple.
MANDATORY
          The reference is mandatory and unary.
MULTIPLE
          The reference is optional and multiple.
OPTIONAL
          The reference is optional and unary.
 
Method Summary
 java.lang.String toString()
           
static ReferenceCardinality valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static ReferenceCardinality[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

OPTIONAL

public static final ReferenceCardinality OPTIONAL
The reference is optional and unary. That is, the reference has a cardinality of 0..1.


MANDATORY

public static final ReferenceCardinality MANDATORY
The reference is mandatory and unary. That is, the reference has a cardinality of 1..1.


MULTIPLE

public static final ReferenceCardinality MULTIPLE
The reference is optional and multiple. That is, the reference has a cardinality of 0..n.


AT_LEAST_ONE

public static final ReferenceCardinality AT_LEAST_ONE
The reference is mandatory and multiple. That is, the reference has a cardinality of 1..n.

Method Detail

values

public static ReferenceCardinality[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ReferenceCardinality c : ReferenceCardinality.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ReferenceCardinality valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

OSGi™ Compendium
Release 5

Copyright © OSGi Alliance (2000, 2013). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0