Interface ViewElementLookupRegistry
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
ViewElementLookupRegistryImpl
Registry that maps
ViewElementBuilder
instances or
element type names fo ViewElementMode
. Has a concept of cacheable communicating to the
EntityViewElementBuilderService
if a generated ViewElementBuilder
can be cached.
NOTE: This class is mainly for internal use by EntityModule, and subject to breaking changes in future releases.- Author:
- Arne Vandamme
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addViewElementPostProcessor
(ViewElementMode mode, com.foreach.across.modules.web.ui.ViewElementPostProcessor<?> postProcessor) Add aViewElementPostProcessor
that should be applied to the element builder.boolean
cacheViewElementBuilder
(ViewElementMode mode, com.foreach.across.modules.web.ui.ViewElementBuilder builder) IfisCacheable(ViewElementMode)
returnsfalse
this call will have no effect and return value should also befalse
.void
Removes all cached builders.clone()
com.foreach.across.modules.web.ui.ViewElementBuilder
Retrieve the (optionally) cached builder.com.foreach.across.modules.web.ui.ViewElementBuilder
Collection<com.foreach.across.modules.web.ui.ViewElementPostProcessor<?>>
boolean
isCacheable
(ViewElementMode mode) If the result of a certain mode is cacheable, this means that an externalEntityViewElementBuilderService
can store back the results of a type lookup or builder creation.boolean
isEmpty()
Checks whether any lookup values have been applied to the registry.void
reset
(ViewElementMode mode) Removes the cached builder for the given mode.void
setCacheable
(ViewElementMode mode, boolean cacheable) Sets the cacheable status for a given mode.void
setViewElementBuilder
(ViewElementMode mode, com.foreach.across.modules.web.ui.ViewElementBuilder builder) Set the fixedViewElementBuilder
for lookups.void
setViewElementType
(ViewElementMode mode, String viewElementType) Set the view element type for subsequent lookup.
-
Method Details
-
setViewElementBuilder
void setViewElementBuilder(ViewElementMode mode, com.foreach.across.modules.web.ui.ViewElementBuilder builder) Set the fixedViewElementBuilder
for lookups. If set, this builder will always be returned.- Parameters:
mode
- to register the builder forbuilder
- instance to store
-
addViewElementPostProcessor
void addViewElementPostProcessor(ViewElementMode mode, com.foreach.across.modules.web.ui.ViewElementPostProcessor<?> postProcessor) Add aViewElementPostProcessor
that should be applied to the element builder.- Parameters:
mode
- to register the postprocessor forpostProcessor
- to add
-
cacheViewElementBuilder
boolean cacheViewElementBuilder(ViewElementMode mode, com.foreach.across.modules.web.ui.ViewElementBuilder builder) IfisCacheable(ViewElementMode)
returnsfalse
this call will have no effect and return value should also befalse
.- Parameters:
mode
- to register the builder forbuilder
- instance to store- Returns:
- true if the builder was actually stored
-
getCachedViewElementBuilder
com.foreach.across.modules.web.ui.ViewElementBuilder getCachedViewElementBuilder(ViewElementMode mode) Retrieve the (optionally) cached builder. Will return null if either not cached or not cacheable.- Parameters:
mode
- to get the builder for- Returns:
- the registered builder - null if none available
-
setViewElementType
Set the view element type for subsequent lookup.- Parameters:
mode
- to register the type forviewElementType
- to store
-
setCacheable
Sets the cacheable status for a given mode.- Parameters:
mode
- to set the status forcacheable
- true if subsequent calls can be cached
-
reset
Removes the cached builder for the given mode.- Parameters:
mode
- to remove the cached builder for
-
clearCache
void clearCache()Removes all cached builders. -
getViewElementBuilder
- Parameters:
mode
- to create the builder for- Returns:
- the registered builder - null if none available
-
getViewElementPostProcessors
Collection<com.foreach.across.modules.web.ui.ViewElementPostProcessor<?>> getViewElementPostProcessors(ViewElementMode mode) - Parameters:
mode
- to get the postprocessors for- Returns:
- collection of postprocessors
-
getViewElementType
- Parameters:
mode
- to create the type for- Returns:
- the registered view element type - null if none available
-
isCacheable
If the result of a certain mode is cacheable, this means that an externalEntityViewElementBuilderService
can store back the results of a type lookup or builder creation. Usually aViewElementBuilder
can be cached.- Parameters:
mode
- to check for- Returns:
- true if a builder can be cached
-
isEmpty
boolean isEmpty()Checks whether any lookup values have been applied to the registry. -
clone
ViewElementLookupRegistry clone()- Returns:
- cloned instance
-