Package com.powsybl.commons.extensions
Class AbstractExtendable<T>
- java.lang.Object
-
- com.powsybl.commons.extensions.AbstractExtendable<T>
-
- All Implemented Interfaces:
Extendable<T>
- Direct Known Subclasses:
BatteryImpl
,ComputationParametersImpl
,Contingency
,DynamicSimulationParameters
,LimitViolation
,LoadFlowParameters
,NetworkMetadata
,SecurityAnalysisParameters
,SecurityAnalysisReport
,SecurityAnalysisResult
,SensitivityAnalysisParameters
public abstract class AbstractExtendable<T> extends Object implements Extendable<T>
- Author:
- Mathieu Bague
-
-
Constructor Summary
Constructors Constructor Description AbstractExtendable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <E extends Extension<T>>
voidaddExtension(Class<? super E> type, E extension)
Add en extension to this extendable object.<E extends Extension<T>>
EgetExtension(Class<? super E> type)
Get an extension based on its class type.<E extends Extension<T>>
EgetExtensionByName(String name)
Get an extension based on its name.Collection<Extension<T>>
getExtensions()
Get all extensions associated with this extendable object..String
getImplementationName()
Returns a name that is used to find matchingExtensionAdderProvider
s when selecting implementations of extensions inExtendable.newExtension(java.lang.Class<B>)
.<E extends Extension<T>>
booleanremoveExtension(Class<E> type)
Remove an extension based on its class type.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.powsybl.commons.extensions.Extendable
newExtension
-
-
-
-
Method Detail
-
addExtension
public <E extends Extension<T>> void addExtension(Class<? super E> type, E extension)
Description copied from interface:Extendable
Add en extension to this extendable object.- Specified by:
addExtension
in interfaceExtendable<T>
- Type Parameters:
E
- the extension type- Parameters:
type
- the extension class typeextension
- the extension
-
getExtension
public <E extends Extension<T>> E getExtension(Class<? super E> type)
Description copied from interface:Extendable
Get an extension based on its class type.- Specified by:
getExtension
in interfaceExtendable<T>
- Type Parameters:
E
- the extension type- Parameters:
type
- the extension class type- Returns:
- the extension mapped to the class type or null if not found
-
getExtensionByName
public <E extends Extension<T>> E getExtensionByName(String name)
Description copied from interface:Extendable
Get an extension based on its name.- Specified by:
getExtensionByName
in interfaceExtendable<T>
- Parameters:
name
- the extension name- Returns:
- the extension mapped to the name or null if not found
-
removeExtension
public <E extends Extension<T>> boolean removeExtension(Class<E> type)
Description copied from interface:Extendable
Remove an extension based on its class type.- Specified by:
removeExtension
in interfaceExtendable<T>
- Type Parameters:
E
- the extension type- Parameters:
type
- the extension class type- Returns:
- true if the extension has been removed false if extension has not been found
-
getExtensions
public Collection<Extension<T>> getExtensions()
Description copied from interface:Extendable
Get all extensions associated with this extendable object..- Specified by:
getExtensions
in interfaceExtendable<T>
- Returns:
- all extensions associated to this extendable object.
-
getImplementationName
public String getImplementationName()
Description copied from interface:Extendable
Returns a name that is used to find matchingExtensionAdderProvider
s when selecting implementations of extensions inExtendable.newExtension(java.lang.Class<B>)
. This is meant to be overriden by extendables when multiple implementations exist.- Specified by:
getImplementationName
in interfaceExtendable<T>
- Returns:
- the name
-
-