Interface EntityProviderListener<T extends EntityProvider>
-
public interface EntityProviderListener<T extends EntityProvider>This allows a developer to be notified whenever a provider is registered, it will also ensure that it calls the listener method for any providers that are already registered when it is first registered if desired
Usage:
Just implement this class and useEntityProviderManager#registerNotifier(EntityProviderNotifier)to register it with the system. Whenever an entity provider is registered therun(EntityProvider)method is called. You can limit the calls to your listener using thegetPrefixFilter()andgetCapabilityFilter().
Note that you can return a null prefix filter and capability filter but it means you will get called for every registration of every provider. You will want to use theEntityProviderfor the generics to receive every capability type.- Author:
- Aaron Zeckoski (azeckoski @ gmail.com)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Class<T>getCapabilityFilter()StringgetPrefixFilter()voidrun(T provider)This method will be called once per each provider that is registered with the system depending on the filter methods in this class
WARNING: Do not hold onto (cache) the provider returned to you by this method, if you need to use it again later you should fetch it using the methods inEntityProviderManagerlikeEntityProviderManager.getProviderByPrefix(String)andEntityProviderManager.getProviderByPrefixAndCapability(String, Class)among others, you can cache the prefix name and capabilities if you need to
-
-
-
Method Detail
-
getPrefixFilter
String getPrefixFilter()
- Returns:
- the prefix to limit the notifications to OR null for any prefix
-
getCapabilityFilter
Class<T> getCapabilityFilter()
- Returns:
- the capability to limit notifications to OR null for any capability (still will only be called once per provider)
-
run
void run(T provider)
This method will be called once per each provider that is registered with the system depending on the filter methods in this class
WARNING: Do not hold onto (cache) the provider returned to you by this method, if you need to use it again later you should fetch it using the methods inEntityProviderManagerlikeEntityProviderManager.getProviderByPrefix(String)andEntityProviderManager.getProviderByPrefixAndCapability(String, Class)among others, you can cache the prefix name and capabilities if you need to- Parameters:
provider- the currently registered provider that you are being notified about
-
-