Package nz.org.riskscape.engine.plugin
Class FactoryFeature<A,T>
java.lang.Object
nz.org.riskscape.engine.plugin.FactoryFeature<A,T>
- All Implemented Interfaces:
PluginFeature
- Direct Known Subclasses:
CliCommand,EngineCollection,ExpressionRealizerFactory,PipelineExecutorFactory
Base class for features that return a new instance of something of a particular SPI, optionally accepting a contextual argument.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetId()static <T,F extends FactoryFeature<?, T>>
Class<T>getSpiClass(Class<F> spiFactoryClass) booleanstatic <T,F extends FactoryFeature<?, T>>
FReturn aFactoryFeatureby subclass, throwing an exception if none (not even a default) is registered.static <T,F extends FactoryFeature<?, T>>
List<F>lookupAll(ExtensionPoints extensionPoints, Class<F> spiFactoryClass) Return allFactoryFeatures by subclass registered in the extensionPoints.newInstance(A arg) toString()
-
Constructor Details
-
FactoryFeature
-
-
Method Details
-
lookupAll
public static <T,F extends FactoryFeature<?, List<F> lookupAllT>> (ExtensionPoints extensionPoints, Class<F> spiFactoryClass) Return all
FactoryFeatures by subclass registered in the extensionPoints. Use this instead ofExtensionPoints.getFeaturesOfType(Class). -
lookup
Return a
FactoryFeatureby subclass, throwing an exception if none (not even a default) is registered.Uses the engine's plugins and settings to lookup settings to see if a default implementation has been replaced.
-
getSpiClass
-
getId
- Returns:
- an id for this feature (based on the class name)
-
getSpiClass
- Returns:
- the service provider interface class, e.g. ExpressionRealizer
-
getContextClass
- Returns:
- the class required by this constructor feature's newInstance method
-
newInstance
-
newInstance
-
toString
-
isDefaultImplementation
public boolean isDefaultImplementation()- Returns:
- true if this factory will return a default implementation of the spi class
-