Interface ViewElementLookupRegistry

All Superinterfaces:
Cloneable
All Known Implementing Classes:
ViewElementLookupRegistryImpl

public interface ViewElementLookupRegistry extends Cloneable
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 Details

    • setViewElementBuilder

      void setViewElementBuilder(ViewElementMode mode, com.foreach.across.modules.web.ui.ViewElementBuilder builder)
      Set the fixed ViewElementBuilder for lookups. If set, this builder will always be returned.
      Parameters:
      mode - to register the builder for
      builder - instance to store
    • addViewElementPostProcessor

      void addViewElementPostProcessor(ViewElementMode mode, com.foreach.across.modules.web.ui.ViewElementPostProcessor<?> postProcessor)
      Add a ViewElementPostProcessor that should be applied to the element builder.
      Parameters:
      mode - to register the postprocessor for
      postProcessor - to add
    • cacheViewElementBuilder

      boolean cacheViewElementBuilder(ViewElementMode mode, com.foreach.across.modules.web.ui.ViewElementBuilder builder)
      If isCacheable(ViewElementMode) returns false this call will have no effect and return value should also be false.
      Parameters:
      mode - to register the builder for
      builder - 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

      void setViewElementType(ViewElementMode mode, String viewElementType)
      Set the view element type for subsequent lookup.
      Parameters:
      mode - to register the type for
      viewElementType - to store
    • setCacheable

      void setCacheable(ViewElementMode mode, boolean cacheable)
      Sets the cacheable status for a given mode.
      Parameters:
      mode - to set the status for
      cacheable - true if subsequent calls can be cached
    • reset

      void reset(ViewElementMode mode)
      Removes the cached builder for the given mode.
      Parameters:
      mode - to remove the cached builder for
    • clearCache

      void clearCache()
      Removes all cached builders.
    • getViewElementBuilder

      com.foreach.across.modules.web.ui.ViewElementBuilder getViewElementBuilder(ViewElementMode mode)
      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

      String getViewElementType(ViewElementMode mode)
      Parameters:
      mode - to create the type for
      Returns:
      the registered view element type - null if none available
    • isCacheable

      boolean isCacheable(ViewElementMode mode)
      If the result of a certain mode is cacheable, this means that an external EntityViewElementBuilderService can store back the results of a type lookup or builder creation. Usually a ViewElementBuilder 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

      Returns:
      cloned instance