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.
Constructor and Description |
---|
ComponentStoreImpl()
Creates a new instance of
ComponentStoreImpl and
initializes it. |
Modifier and Type | Method and Description |
---|---|
void |
add(String name,
Object component)
Adds a new component to this store.
|
void |
addComponentHandler(String name,
ComponentHandler<?> handler)
Adds a new component handler to this store.
|
void |
addFieldHandler(String name,
FieldHandler fldHandler)
Adds a new field handler to this store.
|
void |
clear()
Clears the content of this store.
|
Object |
findComponent(String name)
Searches the component with the specified name.
|
ComponentHandler<?> |
findComponentHandler(String name)
Searches the component handler with the specified name.
|
FieldHandler |
findFieldHandler(String name)
Searches the field handler with the specified name.
|
Set<String> |
getComponentHandlerNames()
Returns a set with the names of all stored component handlers.
|
Set<String> |
getComponentNames()
Returns a set with the names of all stored components.
|
Set<String> |
getFieldHandlerNames()
Returns a set with the names of all stored field handlers.
|
public ComponentStoreImpl()
ComponentStoreImpl
and
initializes it.public void add(String name, Object component)
add
in interface ComponentStore
name
- the name of the componentcomponent
- the component to be addedIllegalArgumentException
- if either name or component are nullpublic void addComponentHandler(String name, ComponentHandler<?> handler)
addComponentHandler
in interface ComponentStore
name
- the name of the handlerhandler
- the handler to be addedIllegalArgumentException
- if either name or component handler are
nullpublic void addFieldHandler(String name, FieldHandler fldHandler)
addFieldHandler
in interface ComponentStore
name
- the name of the field handlerfldHandler
- the handler to be addedIllegalArgumentException
- if either name or handler are nullpublic Object findComponent(String name)
findComponent
in interface ComponentStore
name
- the namepublic ComponentHandler<?> findComponentHandler(String name)
findComponentHandler
in interface ComponentStore
name
- the namepublic FieldHandler findFieldHandler(String name)
findFieldHandler
in interface ComponentStore
name
- the namepublic Set<String> getComponentHandlerNames()
getComponentHandlerNames
in interface ComponentStore
public Set<String> getComponentNames()
getComponentNames
in interface ComponentStore
public Set<String> getFieldHandlerNames()
getFieldHandlerNames
in interface ComponentStore
public void clear()
Copyright © 2016 The JGUIraffe Team. All rights reserved.