Class ScopedAttributesViewElementBuilderContext

java.lang.Object
com.foreach.across.modules.web.ui.ScopedAttributesViewElementBuilderContext
All Implemented Interfaces:
AutoCloseable

public class ScopedAttributesViewElementBuilderContext extends Object implements AutoCloseable
Represents a collection of temporary modifications to an existing ViewElementBuilderContext. Unlike creating a new builder context, this will apply changes to the existing context, but will rollback those changes then close() is called.
Since:
3.1.1
Author:
Arne Vandamme
  • Constructor Details

    • ScopedAttributesViewElementBuilderContext

      public ScopedAttributesViewElementBuilderContext(@NonNull @NonNull ViewElementBuilderContext builderContext)
  • Method Details

    • withAttributeOverride

      public <Y> ScopedAttributesViewElementBuilderContext withAttributeOverride(@NonNull @NonNull Class<Y> attributeType, Y attributeValue)
      Override an attribute value. Passing null as attribute value is the same as calling removeAttribute(String).
      Parameters:
      attributeType - type of the attribute to override
      attributeValue - value to override the attribute with
      Returns:
      current builder context scope
    • withAttributeOverride

      public ScopedAttributesViewElementBuilderContext withAttributeOverride(@NonNull @NonNull String attributeName, Object attributeValue)
      Override an attribute value. Passing null as attribute value is the same as calling removeAttribute(String).
      Parameters:
      attributeName - name of the attribute to override
      attributeValue - value to override the attribute with
      Returns:
      current builder context scope
    • removeAttribute

      public ScopedAttributesViewElementBuilderContext removeAttribute(@NonNull @NonNull Class attributeType)
      Remove an attribute from the builder context.
      Parameters:
      attributeType - type of the attribute to remove
      Returns:
      current builder context scope
    • removeAttribute

      public ScopedAttributesViewElementBuilderContext removeAttribute(@NonNull @NonNull String attributeName)
      Remove an attribute from the builder context.
      Parameters:
      attributeName - name of the attribute to remove
      Returns:
      current builder context scope
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable