org.eclipse.emf.emfstore.common.extensionpoint
Class ESExtensionElement

java.lang.Object
  extended by org.eclipse.emf.emfstore.common.extensionpoint.ESExtensionElement

public final class ESExtensionElement
extends Object

This is the companion class to ESExtensionPoint. It wraps a IConfigurationElement for convenience purposes. As ESExtensionPoint it can be configured to return null or throw an runtime exception ESExtensionPointException

Author:
wesendon

Constructor Summary
ESExtensionElement(org.eclipse.core.runtime.IConfigurationElement element)
          Default constructor.
ESExtensionElement(org.eclipse.core.runtime.IConfigurationElement element, boolean throwExceptions)
          Constructor, allowing to set whether exceptions should be thrown instead of returning null.
 
Method Summary
 String getAttribute(String name)
          Returns an attribute as string.
 Boolean getBoolean(String name)
          Returns the value of the boolean attribute, if existing, or false otherwise.
 Boolean getBoolean(String name, boolean defaultValue)
          Returns the value of the boolean attribute, if existing, or given defaultValue otherwise.
<T> T
getClass(String classAttributeName, Class<T> returnType)
          Returns a class, or rather the registered instance of this class.
 org.eclipse.core.runtime.IConfigurationElement getIConfigurationElement()
          Returns the wrapped element.
 Integer getInteger(String name)
          Returns an Integer attribute.
 boolean getThrowException()
          Returns whether exceptions are thrown or null is returned.
 void setThrowException(boolean throwException)
          Set wrapper to throw exceptions or otherwise return null.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ESExtensionElement

public ESExtensionElement(org.eclipse.core.runtime.IConfigurationElement element)
Default constructor.

Parameters:
element - element to be wrapped

ESExtensionElement

public ESExtensionElement(org.eclipse.core.runtime.IConfigurationElement element,
                          boolean throwExceptions)
Constructor, allowing to set whether exceptions should be thrown instead of returning null.

Parameters:
element - element to be wrapped
throwExceptions - if true exceptions are thrown instead of returning null
Method Detail

getBoolean

public Boolean getBoolean(String name)
Returns the value of the boolean attribute, if existing, or false otherwise.

Parameters:
name - attribute id
Returns:
Boolean or an ESExtensionPointException is thrown

getBoolean

public Boolean getBoolean(String name,
                          boolean defaultValue)
Returns the value of the boolean attribute, if existing, or given defaultValue otherwise.

Parameters:
name - attribute id
defaultValue - the default value
Returns:
Boolean or an ESExtensionPointException is thrown

getInteger

public Integer getInteger(String name)
Returns an Integer attribute.

Parameters:
name - attribute id
Returns:
Integer, null or an ESExtensionPointException is thrown

getAttribute

public String getAttribute(String name)
Returns an attribute as string.

Parameters:
name - attribute id
Returns:
String, null or an ESExtensionPointException is thrown

getClass

public <T> T getClass(String classAttributeName,
                      Class<T> returnType)
Returns a class, or rather the registered instance of this class.

Type Parameters:
T - type of class
Parameters:
classAttributeName - attribute name of the class attribute
returnType - expected class type
Returns:
Instance, null or a ESExtensionPointException is thrown

getIConfigurationElement

public org.eclipse.core.runtime.IConfigurationElement getIConfigurationElement()
Returns the wrapped element.

Returns:
IConfigurationElement

setThrowException

public void setThrowException(boolean throwException)
Set wrapper to throw exceptions or otherwise return null.

Parameters:
throwException - if true, exceptions are thrown

getThrowException

public boolean getThrowException()
Returns whether exceptions are thrown or null is returned.

Returns:
boolean


Copyright © 2015. All Rights Reserved.