Interface SingleTypeComponentFactory<K,C extends Component<K>>

Type Parameters:
K - the component key
C - 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 a ComponentFactory that supports only a single key.
Since:
1.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates the single Component supported by this factory.
    default C
    create(K key)
    Creates the Component associated with the supplied key.
    default Set<C>
    Creates a singleton set of the Component supported by this factory.
    Gets the single key supported by this factory.
    default Set<K>
    Creates a singleton set of the key supported by this factory.
    default boolean
    has(K key)
    Checks if the key is the key supported by this factory.
  • Method Details

    • create

      C create()
      Creates the single Component supported 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 the Component associated with the supplied key. Whether this method will always return the same instance or a fresh instance for each call is implementation dependent.
      Specified by:
      create in interface ComponentFactory<K,C extends Component<K>>
      Parameters:
      key - the key
      Returns:
      the Component
      Throws:
      IllegalArgumentException - if key does not equal the key of this factory.
    • createAll

      default Set<C> createAll()
      Creates a singleton set of the Component supported by this factory.
      Specified by:
      createAll in interface ComponentFactory<K,C extends Component<K>>
      Returns:
      the component
    • getKey

      K getKey()
      Gets the single key supported by this factory.
      Returns:
      the key
    • getKeys

      default Set<K> getKeys()
      Creates a singleton set of the key supported by this factory.
      Specified by:
      getKeys in interface ComponentFactory<K,C extends Component<K>>
      Specified by:
      getKeys in interface Keyed<K>
      Returns:
      the key
    • has

      default boolean has(K key)
      Checks if the key is the key supported by this factory.
      Specified by:
      has in interface ComponentFactory<K,C extends Component<K>>
      Parameters:
      key - the key
      Returns:
      if the key is the key supported