Class ClassBasedExtension
- java.lang.Object
-
- org.eclipse.epsilon.common.dt.extensions.ClassBasedExtension
-
public class ClassBasedExtension extends java.lang.Object
Class which looks up and creates the instances of the classes referred to through the specified extension point. The extension point must declare an attribute of type "java" and nameCLASS_PROPERTY
. Referenced classes should implement a certain interface or inherit from a certain class.- Version:
- 1.0
- Author:
- Antonio García-Domínguez
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLASS_PROPERTY
-
Constructor Summary
Constructors Constructor Description ClassBasedExtension(org.eclipse.core.runtime.IConfigurationElement configElement, java.lang.Class<?> expectedClass)
Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
createInstance()
Instantiates the referenced class.java.lang.String
getClassName()
Returns the fully qualified class name of the referenced class, as set in the extension.static <T> java.util.List<T>
getImplementations(java.lang.String extensionPointID, java.lang.Class<T> expectedClass)
Returns a list with instances of the classes registered in the available extensions for this extension point.static java.util.List<ClassBasedExtension>
getInstances(java.lang.String extensionPointID, java.lang.Class<?> expectedClass)
Returns a list with the available extensions for this extension point.
-
-
-
Field Detail
-
CLASS_PROPERTY
public static final java.lang.String CLASS_PROPERTY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ClassBasedExtension
public ClassBasedExtension(org.eclipse.core.runtime.IConfigurationElement configElement, java.lang.Class<?> expectedClass)
Creates a new instance.- Parameters:
configElement
- Configuration element from the extension element.expectedClass
- Superclass or interface to which the referenced class should comply.
-
-
Method Detail
-
getInstances
public static java.util.List<ClassBasedExtension> getInstances(java.lang.String extensionPointID, java.lang.Class<?> expectedClass)
Returns a list with the available extensions for this extension point.
-
getImplementations
public static <T> java.util.List<T> getImplementations(java.lang.String extensionPointID, java.lang.Class<T> expectedClass) throws IllegalExtensionException
Returns a list with instances of the classes registered in the available extensions for this extension point.- Throws:
IllegalExtensionException
-
getClassName
public java.lang.String getClassName()
Returns the fully qualified class name of the referenced class, as set in the extension.
-
createInstance
public java.lang.Object createInstance() throws IllegalExtensionException
Instantiates the referenced class.- Throws:
IllegalExtensionException
-
-