X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=system%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fcore%2FProvidedInterface.java;h=fe7f7d26a73483907d0102b29050c86455f8d55c;hb=fc10e15e031cf409146b04cbb5e98b649c6ccddc;hp=349197d0f2b8a450ee39ea5e21a6c4dfc10f2ffa;hpb=d89a08c127770dfe9b25e88495c7545bbcc938fa;p=utils diff --git a/system/general/src/main/java/org/wamblee/system/core/ProvidedInterface.java b/system/general/src/main/java/org/wamblee/system/core/ProvidedInterface.java index 349197d0..fe7f7d26 100644 --- a/system/general/src/main/java/org/wamblee/system/core/ProvidedInterface.java +++ b/system/general/src/main/java/org/wamblee/system/core/ProvidedInterface.java @@ -19,6 +19,7 @@ import java.util.Collection; /** * Represents an interface provided by a component. + * Different component objects should never share ProvidedInterface instances! * * @author Erik Brakkee */ @@ -37,14 +38,24 @@ public interface ProvidedInterface { Class[] getInterfaceTypes(); /** - * Publish an implementation of the interface. - * @param aImplementation + * Sets a unique id of the provided interface to identify it within a given scope. + * Will be called by the container as part of calling {@link #publish(Object, Scope)}. + * @param aId Unique id. */ - void publish(Object aImplementation); - + void setUniqueId(String aId); + + /** + * Gets the unique if of the provided interface. This is set by the container + * using {@link #setUniqueId(String)}. + */ + String getUniqueId(); + /** - * Gets the implementation. - * @return Implementation or null if not started. + * Publishes an implementation of the interface. The implementation must + * call {@link Scope#publishInterface(ProvidedInterface, Object)} to publish the + * interface implementation in a given scope. + * @param aImplementation Implementation to publish. + * @param aScope Scope in which to publish the implementation. */ - Object getImplementation(); + void publish(Object aImplementation, Scope aScope); }