Class ComponentStoreImpl

  • All Implemented Interfaces:
    ComponentStore

    public class ComponentStoreImpl
    extends Object
    implements ComponentStore

    A fully functional default implementation of the ComponentStore interface.

    This implementation keeps the managed components and handlers in maps where they can directly be accessed. The components of the stored component handlers are also put in the map for the components, so the name spaces of these entities are not disjunct.

    For field handlers situation is similar: The component handlers associated to the added field handlers will be added to the map with the component handlers, too (and their components will in turn be added to the component map). So access to the stored entities is somewhat hierarchical.

    Version:
    $Id: ComponentStoreImpl.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • ComponentStoreImpl

        public ComponentStoreImpl()
        Creates a new instance of ComponentStoreImpl and initializes it.
    • Method Detail

      • add

        public void add​(String name,
                        Object component)
        Adds a new component to this store.
        Specified by:
        add in interface ComponentStore
        Parameters:
        name - the name of the component
        component - the component to be added
        Throws:
        IllegalArgumentException - if either name or component are null
      • findComponent

        public Object findComponent​(String name)
        Searches the component with the specified name.
        Specified by:
        findComponent in interface ComponentStore
        Parameters:
        name - the name
        Returns:
        the component with this name or null if it cannot be found
      • findComponentHandler

        public ComponentHandler<?> findComponentHandler​(String name)
        Searches the component handler with the specified name.
        Specified by:
        findComponentHandler in interface ComponentStore
        Parameters:
        name - the name
        Returns:
        the component handler with this name or null if it cannot be found
      • findFieldHandler

        public FieldHandler findFieldHandler​(String name)
        Searches the field handler with the specified name.
        Specified by:
        findFieldHandler in interface ComponentStore
        Parameters:
        name - the name
        Returns:
        the field handler with this name or null if it cannot be found
      • getComponentHandlerNames

        public Set<String> getComponentHandlerNames()
        Returns a set with the names of all stored component handlers.
        Specified by:
        getComponentHandlerNames in interface ComponentStore
        Returns:
        the names of the stored component handlers
      • getComponentNames

        public Set<String> getComponentNames()
        Returns a set with the names of all stored components.
        Specified by:
        getComponentNames in interface ComponentStore
        Returns:
        the names of the stored components
      • getFieldHandlerNames

        public Set<String> getFieldHandlerNames()
        Returns a set with the names of all stored field handlers.
        Specified by:
        getFieldHandlerNames in interface ComponentStore
        Returns:
        the names of the stored field handlers
      • clear

        public void clear()
        Clears the content of this store. After that this object is exactly like a newly created one.