org.eclipse.emf.emfstore.internal.common
Class ExtensionRegistry

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.common.ExtensionRegistry

public final class ExtensionRegistry
extends Object

The extension registry may be used as simple replacement for the extension point mechanism in case one does not want to expose internal types. It is capable of retrieving actual extension point information, but currently does not support contributing such.

Author:
emueller

Field Summary
static ExtensionRegistry INSTANCE
          The singleton instance.
 
Method Summary
<T> T
get(String id, Class<T> clazz)
          Returns the requested extension point.
<T> T
get(String id, Class<T> clazz, T defaultInstance, boolean shouldSetDefault)
          Returns the requested extension point.
 void remove(String id)
          Remove the extension with the given ID.
<T> void
set(String id, T t)
          Set the extension.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final ExtensionRegistry INSTANCE
The singleton instance.

Method Detail

get

public <T> T get(String id,
                 Class<T> clazz,
                 T defaultInstance,
                 boolean shouldSetDefault)
Returns the requested extension point.

Type Parameters:
T - the expected type
Parameters:
id - the ID of the extension point to be returned
clazz - the expected type
defaultInstance - a default instance to be returned in case no extension point has been found
shouldSetDefault - whether the default instance should be registered
Returns:
the requested extension which might be the default instance specified

get

public <T> T get(String id,
                 Class<T> clazz)
Returns the requested extension point.

Type Parameters:
T - the expected type
Parameters:
id - the ID of the extension point to be returned
clazz - the expected type
Returns:
the requested extension which might be the default instance specified

set

public <T> void set(String id,
                    T t)
Set the extension.

Type Parameters:
T - the type of the extension to be set
Parameters:
id - the ID of the extension point to be returned
t - the extension to be set

remove

public void remove(String id)
Remove the extension with the given ID.

Parameters:
id - the ID of the extension to be removed


Copyright © 2015. All Rights Reserved.