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 forGenericXtextToolProvider
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
Constructors Constructor Description GenericXtextToolProviderImpl(javax.inject.Provider<com.google.inject.Injector> standaloneInjectorProvider, Class<T> requestedType, String extensionPointId, String extensionPointAttr)
Initializes the base class with necessary information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
get()
protected Optional<T>
getExtension()
Gets the requested tool from the extension point given in the constructor.protected T
getStandalone()
Gets the requested tool based on a standalone initialization.
-
-
-
Constructor Detail
-
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 Detail
-
getExtension
protected Optional<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
protected T getStandalone()
Gets the requested tool based on a standalone initialization.- Returns:
- The created tool.
-
-