Class ScopedAttributesViewElementBuilderContext
java.lang.Object
com.foreach.across.modules.web.ui.ScopedAttributesViewElementBuilderContext
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionScopedAttributesViewElementBuilderContext(@NonNull ViewElementBuilderContext builderContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()removeAttribute(@NonNull Class attributeType) Remove an attribute from the builder context.removeAttribute(@NonNull String attributeName) Remove an attribute from the builder context.withAttributeOverride(@NonNull Class<Y> attributeType, Y attributeValue) Override an attribute value.withAttributeOverride(@NonNull String attributeName, Object attributeValue) Override an attribute value.
-
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. Passingnullas attribute value is the same as callingremoveAttribute(String).- Parameters:
attributeType- type of the attribute to overrideattributeValue- 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. Passingnullas attribute value is the same as callingremoveAttribute(String).- Parameters:
attributeName- name of the attribute to overrideattributeValue- 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:
closein interfaceAutoCloseable
-