Package org.n52.janmayen.component
Interface SingleTypeComponentFactory<K,C extends Component<K>>
-
- Type Parameters:
K- the component keyC- the component type
- All Superinterfaces:
ComponentFactory<K,C>,Keyed<K>
public interface SingleTypeComponentFactory<K,C extends Component<K>> extends ComponentFactory<K,C>
Convenience interface for aComponentFactorythat supports only a single key.- Since:
- 1.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Ccreate()Creates the singleComponentsupported by this factory.default Ccreate(K key)Creates theComponentassociated with the suppliedkey.default Set<C>createAll()Creates a singleton set of theComponentsupported by this factory.KgetKey()Gets the single key supported by this factory.default Set<K>getKeys()Creates a singleton set of the key supported by this factory.default booleanhas(K key)Checks if thekeyis the key supported by this factory.
-
-
-
Method Detail
-
create
C create()
Creates the singleComponentsupported by this factory. Whether this method will always return the same instance or a fresh instance for each call is implementation dependent.- Returns:
- the component
-
create
default C create(K key)
Creates theComponentassociated with the suppliedkey. Whether this method will always return the same instance or a fresh instance for each call is implementation dependent.- Specified by:
createin interfaceComponentFactory<K,C extends Component<K>>- Parameters:
key- the key- Returns:
- the
Component - Throws:
IllegalArgumentException- ifkeydoes not equal the key of this factory.
-
createAll
default Set<C> createAll()
Creates a singleton set of theComponentsupported by this factory.
-
getKey
K getKey()
Gets the single key supported by this factory.- Returns:
- the key
-
-