Commit 94f68503 authored by R.W.Majeed's avatar R.W.Majeed

retrieve registered extensions by instance type

parent 3fb959bc
......@@ -38,6 +38,8 @@ public interface ObservationFactory {
*/
void registerExtension(Extension<?> extension);
<T> Extension<T> getExtension(Class<T> type);
/**
* Get a list of currently registered extensions
* @return currently registered extensions
......
......@@ -190,5 +190,14 @@ public class ObservationFactoryImpl implements ObservationFactory{
}
};
}
@SuppressWarnings("unchecked")
@Override
public <T> Extension<T> getExtension(Class<T> extensionType) {
ExtensionEntry e = extensions.get(extensionType);
if( e == null ){
return null;
}
return (Extension<T>) e.extension;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment