Class Multiton
- java.lang.Object
-
- org.apache.axiom.testing.multiton.Multiton
-
public abstract class Multiton extends Object
Base class for multitons. A multiton is a class that has a fixed set of instances. The base class also provides a simple mechanism that allows to extend the behavior of a multiton using adapters.The set of instances of a multiton is determined by:
- The values of all public static final fields in the multiton class that have types that are assignment compatible with the multiton class.
- The array elements returned by methods in the multiton class annotated with
Instances. These methods must be private static, have no parameters and return an array with an component type assignment compatible with the multiton class.
-
-
Constructor Summary
Constructors Constructor Description Multiton()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetAdapter(Class<T> type)static <T extends Multiton>
List<T>getInstances(Class<T> multitonClass)Get all instances of the given multiton.
-
-
-
Method Detail
-
getInstances
public static <T extends Multiton> List<T> getInstances(Class<T> multitonClass)
Get all instances of the given multiton. See the Javadoc of theMultitonclass for information about how the instances are determined.- Parameters:
multitonClass- the multiton class- Returns:
- the list of instances
- Throws:
MultitonInstantiationException- if an error occurred
-
getAdapter
public final <T> T getAdapter(Class<T> type)
-
-