|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.formulacompiler.runtime.ImplementationLocator
public final class ImplementationLocator
Very simple service locator for AFC. Uses the same mechanism as Java 6's
java.util.ServiceLoader
to locate implementation classes, that is, files of the desired
class's name in "META-INF/services/" containing lines which specify the implementor class names.
It currently does not use java.util.ServiceLoader
internally because I do not yet want to
assume Java 6.
Nested Class Summary | |
---|---|
static class |
ImplementationLocator.ConfigurationException
Exception thrown when configuration errors occur. |
static class |
ImplementationLocator.ConfigurationMissingException
Exception thrown when a configuration is missing for a single instance request. |
Constructor Summary | |
---|---|
ImplementationLocator()
|
Method Summary | ||
---|---|---|
static
|
getInstance(java.lang.Class<T> _class)
Returns a newly constructed instance of the implementor class of the given abstract class or interface. |
|
static
|
getInstances(java.lang.Class<T> _class)
Like getInstance(Class) , but returns a collection of all matching implementations. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImplementationLocator()
Method Detail |
---|
public static <T> T getInstance(java.lang.Class<T> _class) throws ImplementationLocator.ConfigurationException, ImplementationLocator.ConfigurationMissingException
T
- is the desired return type._class
- is the class of the desired return type.
ImplementationLocator.ConfigurationException
- for all internal declared exceptions, with the cause set to the
internal exception.
ImplementationLocator.ConfigurationMissingException
- when the configuration file is missing.public static <T> java.util.Collection<T> getInstances(java.lang.Class<T> _class) throws ImplementationLocator.ConfigurationException
getInstance(Class)
, but returns a collection of all matching implementations.
T
- is the desired return type._class
- is the class of the desired return type.
ImplementationLocator.ConfigurationException
- for all internal declared exceptions, with the cause set to the
internal exception.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |