Class GenericXtextToolProviderImpl<T>
java.lang.Object
org.palladiosimulator.commons.stoex.api.impl.generic.GenericXtextToolProviderImpl<T>
- Type Parameters:
T
- The type of the requested tool.
- All Implemented Interfaces:
javax.inject.Provider<T>
,GenericXtextToolProvider<T>
- Direct Known Subclasses:
PlainXtextStoExParserProvider
,PlainXtextStoExSerialiserProvider
public abstract class GenericXtextToolProviderImpl<T>
extends Object
implements GenericXtextToolProvider<T>
Abstract base class for
GenericXtextToolProvider
implementations.
The logic first tries to collect an implementation from an extension point and tries to create an
instance from a standalone initialised provider afterwards. The implementation guarantees to
return an implementation if the requested tool type can be provided by the Xtext framework.-
Constructor Summary
ConstructorDescriptionGenericXtextToolProviderImpl
(javax.inject.Provider<com.google.inject.Injector> standaloneInjectorProvider, Class<T> requestedType, String extensionPointId, String extensionPointAttr) Initializes the base class with necessary information. -
Method Summary
-
Constructor Details
-
GenericXtextToolProviderImpl
public GenericXtextToolProviderImpl(javax.inject.Provider<com.google.inject.Injector> standaloneInjectorProvider, Class<T> requestedType, String extensionPointId, String extensionPointAttr) Initializes the base class with necessary information.- Parameters:
standaloneInjectorProvider
- Provider for a standalone instance of the language injector.requestedType
- The type of the requested tool.extensionPointId
- The extension point id that provides implementations for the requested tool.extensionPointAttr
- The attribute that contains the tool object.
-
-
Method Details
-
get
- Specified by:
get
in interfacejavax.inject.Provider<T>
-
getExtension
Gets the requested tool from the extension point given in the constructor. If multiple extensions are provided, the implementation returns a random implementation.- Returns:
- The found extension or an empty
Optional
otherwise.
-
getStandalone
Gets the requested tool based on a standalone initialization.- Returns:
- The created tool.
-