Class AbstractComponentRegistry<R extends AbstractComponentRegistry<R>>
- All Implemented Interfaces:
ComponentRegistry<R>
- Direct Known Subclasses:
DefaultComponentRegistry
ComponentRegistry used for storing and retrieving
Components.
This registry is typically configured as a bean during the auto-configuration of a Spring Boot
application. In most cases, the initialize(List, List) method will be called shortly
after instantiation to initialize the registry using a set of ComponentSource and
FrameworkComponentSource beans. FrameworkComponentSource beans will be processed
prior to the ComponentSource beans, which allows ComponentSource beans to
potentially extend or modify the framework components.
Once the registry has been initialized by the component sources, the initialization will make a
call to validateRegistry() in order to validate each and every component within the
registry using ComponentValidatorManager. If isFailOnValidationError() is true,
this will cause an IllegalStateException to be thrown.
- Author:
- Nick Crum (ncrum)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddComponent(String id, Component<?> component) Component<?><T extends Component<T>>
TComponent<?>getComponent(String id) <T extends Component<T>>
TgetComponent(String id, Class<T> clazz) booleanbooleanhasComponent(String id) voidinitialize(List<FrameworkComponentSource> frameworkComponentSources, List<ComponentSource> componentSources) Primary method of initializing the registry with components.booleanprotected Rself()voidsetFailOnValidationError(boolean failOnValidationError) voidValidates each component within the registry using theComponentValidatorManager.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.metadata.dsl.registry.ComponentRegistry
reRegisterComponents
-
Constructor Details
-
AbstractComponentRegistry
-
-
Method Details
-
initialize
public void initialize(@Nullable List<FrameworkComponentSource> frameworkComponentSources, @Nullable List<ComponentSource> componentSources) Primary method of initializing the registry with components.First, the list of
FrameworkComponentSourcewill be used to register any frameworkComponents. Second, the list ofComponentSourcewill be used to register new components and extend any framework components. Lastly, theComponentValidatorManagerwill be used invalidateRegistry()to validate every the components within the registry.- Parameters:
frameworkComponentSources- the list of sources of framework componentscomponentSources- the list of sources of components
-
validateRegistry
public void validateRegistry()Validates each component within the registry using theComponentValidatorManager.If
isFailOnValidationError()is set to true, then any validation errors will cause anIllegalStateExceptionto be thrown. If it is set to false, then no exception will be thrown, but debug logging may still occur within theComponentValidatorManager. -
self
-
addComponent
- Specified by:
addComponentin interfaceComponentRegistry<R extends AbstractComponentRegistry<R>>
-
add
- Specified by:
addin interfaceComponentRegistry<R extends AbstractComponentRegistry<R>>
-
add
- Specified by:
addin interfaceComponentRegistry<R extends AbstractComponentRegistry<R>>
-
removeComponent
- Specified by:
removeComponentin interfaceComponentRegistry<R extends AbstractComponentRegistry<R>>
-
remove
- Specified by:
removein interfaceComponentRegistry<R extends AbstractComponentRegistry<R>>
-
hasComponent
- Specified by:
hasComponentin interfaceComponentRegistry<R extends AbstractComponentRegistry<R>>
-
has
- Specified by:
hasin interfaceComponentRegistry<R extends AbstractComponentRegistry<R>>
-
getComponent
- Specified by:
getComponentin interfaceComponentRegistry<R extends AbstractComponentRegistry<R>>
-
getComponent
- Specified by:
getComponentin interfaceComponentRegistry<R extends AbstractComponentRegistry<R>>
-
get
- Specified by:
getin interfaceComponentRegistry<R extends AbstractComponentRegistry<R>>
-
get
- Specified by:
getin interfaceComponentRegistry<R extends AbstractComponentRegistry<R>>
-
getValidatorManager
-
getComponents
- Specified by:
getComponentsin interfaceComponentRegistry<R extends AbstractComponentRegistry<R>>
-
isFailOnValidationError
public boolean isFailOnValidationError() -
setFailOnValidationError
public void setFailOnValidationError(boolean failOnValidationError)
-