|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.emfstore.common.extensionpoint.ESExtensionPoint
public final class ESExtensionPoint
This class is a convenience wrapper for eclipse extension points. It can be configured to return null if a value can't be found, but also to throw Exceptions. The latter normally requires a catch block but you don't have to null check.
Constructor Summary | |
---|---|
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. |
Method Summary | ||
---|---|---|
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() ). |
|
|
getClass(String classAttributeName,
Class<T> returnType)
Gets a class from the element with highest priority ( getElementWithHighestPriority() , default
getFirst() ). |
|
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 . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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 ESExtensionElement
sMethod Detail |
---|
public 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 value
setThrowException(boolean)
is true.public Boolean getBoolean(String name)
getElementWithHighestPriority()
, default getFirst()
).
name
- attribute id
setThrowException(boolean)
is true.public Boolean getBoolean(String name, boolean defaultValue)
getElementWithHighestPriority()
, default getFirst()
).
name
- attribute iddefaultValue
- the default value if attribute does not exist
setThrowException(boolean)
is true.public Integer getInteger(String name)
getElementWithHighestPriority()
, default
getFirst()
).
name
- attribute id
setThrowException(boolean)
is true.public String getAttribute(String name)
getElementWithHighestPriority()
, default getFirst()
).
name
- attribute id
setThrowException(boolean)
is true.public ESExtensionElement getElementWithHighestPriority()
getFirst()
is used. This method is intended to be
overriden in order to modify default behavior.
ESExtensionElement
public 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()
ESExtensionElement
public ESExtensionPoint setThrowException(boolean b)
b
- true to throw exceptions
public int size()
ESExtensionElement
.
public String getId()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |