Class ServiceLookupImpl<S extends Service<?>,SCTX>

java.lang.Object
org.refcodes.servicebus.ServiceLookupImpl<S,SCTX>
Type Parameters:
S - The type to be used for the Service.
SCTX - The type to be used for the Service's context.
All Implemented Interfaces:
ServiceLookup<S,SCTX>

public class ServiceLookupImpl<S extends Service<?>,SCTX> extends Object implements ServiceLookup<S,SCTX>
The ServiceLookupImpl implements the ServiceLookup.
  • Constructor Details

    • ServiceLookupImpl

      public ServiceLookupImpl(org.refcodes.factory.CollectionFactory<Set<ServiceDescriptor<S,SCTX>>> aTypedTypeFactory)
      Creates a ServiceLookupImpl for the required type.
      Parameters:
      aTypedTypeFactory - The factory to be used to lookup the given type's instances.
  • Method Details

    • getServiceDescriptors

      public Set<ServiceDescriptor<S,SCTX>> getServiceDescriptors()
      Returns a collection containing the ServiceDescriptor instances known by the ServiceLookup.
      Specified by:
      getServiceDescriptors in interface ServiceLookup<S extends Service<?>,SCTX>
      Returns:
      A collection containing the ServiceDescriptor instances known by the ServiceLookup.
    • hasService

      public boolean hasService(ServiceDescriptor<S,SCTX> aServiceDescriptor)
      Determines whether the given service is known by the service bus by taking the service type and the service Meta-Data as criteria, not the service identity. I.e. there must not be the same service twice on the service bus which can not be distinguished by its type and its Meta-Data (i.e. a matcher must be able to distinguish two services from each other).
      Specified by:
      hasService in interface ServiceLookup<S extends Service<?>,SCTX>
      Parameters:
      aServiceDescriptor - the service descriptor
      Returns:
      True in case the given service is known by the service bus.