Package org.n52.janmayen.component
Class AbstractComponentRepository<K,C extends Component<K>,F extends ComponentFactory<K,C>>
java.lang.Object
org.n52.janmayen.component.AbstractComponentRepository<K,C,F>
- Type Parameters:
K- the component key typeC- the component typeF- the component factory type
- Direct Known Subclasses:
AbstractSimilarityKeyComponentRepository
public abstract class AbstractComponentRepository<K,C extends Component<K>,F extends ComponentFactory<K,C>>
extends Object
Abstract class to encapsulate the loading of implementations that are registered with the ServiceLoader interface.
- Since:
- 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetProviders(Collection<? extends C> components, Collection<? extends F> factories) Create a multi valued map withProducers for the suppliedcomponentsandfactories.getProviders(Optional<? extends Collection<? extends C>> components, Optional<? extends Collection<? extends F>> factories) Create a multi valued map withProducers for the suppliedcomponentsandfactories.getUniqueProviders(Collection<? extends C> components, Collection<? extends F> factories) Create a map withProducers for the suppliedcomponentsandfactories.getUniqueProviders(Optional<? extends Collection<? extends C>> components, Optional<? extends Collection<? extends F>> factories) Create a map withProducers for the suppliedcomponentsandfactories.
-
Constructor Details
-
AbstractComponentRepository
public AbstractComponentRepository()
-
-
Method Details
-
getProviders
protected Map<K,Set<Producer<C>>> getProviders(Optional<? extends Collection<? extends C>> components, Optional<? extends Collection<? extends F>> factories) Create a multi valued map withProducers for the suppliedcomponentsandfactories.- Parameters:
components- the component instancesfactories- the component factories- Returns:
- the producers
-
getProviders
protected Map<K,Set<Producer<C>>> getProviders(Collection<? extends C> components, Collection<? extends F> factories) Create a multi valued map withProducers for the suppliedcomponentsandfactories.- Parameters:
components- the component instances (may benullor empty)factories- the component factories (may benullor empty)- Returns:
- the producers
-
getUniqueProviders
protected Map<K,Producer<C>> getUniqueProviders(Optional<? extends Collection<? extends C>> components, Optional<? extends Collection<? extends F>> factories) Create a map withProducers for the suppliedcomponentsandfactories. Components or factories with the same keys are discarded.- Parameters:
components- the component instancesfactories- the component factories- Returns:
- the producers
-
getUniqueProviders
protected Map<K,Producer<C>> getUniqueProviders(Collection<? extends C> components, Collection<? extends F> factories) Create a map withProducers for the suppliedcomponentsandfactories. Components or factories with the same keys are discarded.- Parameters:
components- the component instances (may benullor empty)factories- the component factories (may benullor empty)- Returns:
- the producers
-