public final class ESExtensionPoint extends Object
| Constructor and Description |
|---|
ESExtensionPoint(String id)
Default constructor.
|
ESExtensionPoint(String id,
boolean throwException)
Constructor with option of set the throw exception option.
|
ESExtensionPoint(String id,
boolean throwException,
Comparator<ESExtensionElement> comparator)
Constructor with option of set the throw exception option.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAttribute(String name)
Gets an attribute in form of a string from the element with highest priority (
getElementWithHighestPriority(), default getFirst()). |
Boolean |
getBoolean(String name)
Returns the value of the boolean attribute, if existing, or given false otherwise, from the element with
highest priority (
getElementWithHighestPriority(), default getFirst()). |
Boolean |
getBoolean(String name,
boolean defaultValue)
Returns the value of the boolean attribute, if existing, or given defaultValue otherwise, from the element with
highest priority (
getElementWithHighestPriority(), default getFirst()). |
<T> T |
getClass(String classAttributeName,
Class<T> returnType)
Gets a class from the element with highest priority (
getElementWithHighestPriority(), default
getFirst()). |
<T> List<T> |
getClasses(String classAttributeName,
Class<T> returnType)
Gets all available classes with the specified type from the elements.
|
ESExtensionElement |
getElementWithHighestPriority()
Returns the element with highest priority, by default
getFirst() is used. |
List<ESExtensionElement> |
getExtensionElements()
Returns the wrapped extension elements.
|
ESExtensionElement |
getFirst()
Returns the first
ESExtensionElement in the list. |
String |
getId()
Returns the ID of the extension point.
|
Integer |
getInteger(String name)
Gets a Integer from the element with highest priority (
getElementWithHighestPriority(), default
getFirst()). |
void |
reload()
Reloads extensions from the registry.
|
void |
setComparator(Comparator<ESExtensionElement> comparator)
Set a custom comparator which defines the order of the
ESExtensionElement. |
ESExtensionPoint |
setThrowException(boolean b)
Set whether null should be returned or exception should be thrown by this class.
|
int |
size()
Returns the number of
ESExtensionElement. |
public ESExtensionPoint(String id)
id - extension point idpublic ESExtensionPoint(String id, boolean throwException)
id - extension point idthrowException - if true, an ESExtensionPointException is thrown instead of returning nullpublic ESExtensionPoint(String id, boolean throwException, Comparator<ESExtensionElement> comparator)
id - extension point idthrowException - if true, an ESExtensionPointException is thrown instead of returning nullcomparator - the comparator which defines the order of the ESExtensionElementspublic void reload()
public <T> T getClass(String classAttributeName, Class<T> returnType)
getElementWithHighestPriority(), default
getFirst()). Or rather the registered instance of that class.T - the type of the classclassAttributeName - class attribute namereturnType - Class of expected return valuesetThrowException(boolean) is true.public <T> List<T> getClasses(String classAttributeName, Class<T> returnType)
T - the type of the classclassAttributeName - class attribute namereturnType - Class of expected return valuepublic Boolean getBoolean(String name)
getElementWithHighestPriority(), default getFirst()).name - attribute idsetThrowException(boolean) is true.public Boolean getBoolean(String name, boolean defaultValue)
getElementWithHighestPriority(), default getFirst()).name - attribute iddefaultValue - the default value if attribute does not existsetThrowException(boolean) is true.public Integer getInteger(String name)
getElementWithHighestPriority(), default
getFirst()).name - attribute idsetThrowException(boolean) is true.public String getAttribute(String name)
getElementWithHighestPriority(), default getFirst()).name - attribute idsetThrowException(boolean) is true.public ESExtensionElement getElementWithHighestPriority()
getFirst() is used. This method is intended to be
overriden in order to modify default behavior.ESExtensionElementpublic void setComparator(Comparator<ESExtensionElement> comparator)
ESExtensionElement.comparator - the comparatorpublic ESExtensionElement getFirst()
ESExtensionElement in the list.ESExtensionElement, null or a ESExtensionPointException is thrown, depending on your
config ( setThrowException(boolean)public List<ESExtensionElement> getExtensionElements()
ESExtensionElementpublic ESExtensionPoint setThrowException(boolean b)
b - true to throw exceptionspublic int size()
ESExtensionElement.public String getId()
Copyright © 2017. All rights reserved.