Class ExecutionAttribute<T>
- java.lang.Object
-
- software.amazon.awssdk.core.interceptor.ExecutionAttribute<T>
-
- Type Parameters:
T
- The type of data associated with this attribute.
public final class ExecutionAttribute<T> extends Object
An attribute attached to a particular execution, stored inExecutionAttributes
. This is typically used as a static final field in anExecutionInterceptor
:class MyExecutionInterceptor implements ExecutionInterceptor { private static final ExecutionAttribute<String> DATA = new ExecutionAttribute<>(); public void beforeExecution(Context.BeforeExecution execution, ExecutionAttributes executionAttributes) { executionAttributes.put(DATA, "Request: " + execution.request()); } public void afterExecution(Context.AfterExecution execution, ExecutionAttributes executionAttributes) { String data = executionAttributes.get(DATA); // Retrieve the value saved in beforeExecution. } }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExecutionAttribute.DerivedAttributeBuilder<T,U>
protected static class
ExecutionAttribute.MappedAttributeBuilder<T,U>
-
Constructor Summary
Constructors Constructor Description ExecutionAttribute(String name)
Creates a newExecutionAttribute
bound to the provided type param.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T,U>
ExecutionAttribute.DerivedAttributeBuilder<T,U>derivedBuilder(String name, Class<T> attributeType, ExecutionAttribute<U> realAttribute)
Create an execution attribute whose value is derived from another attribute.boolean
equals(Object o)
This override considers execution attributes with the same name to be the same object for the purpose of attribute merge.int
hashCode()
This override considers execution attributes with the same name to be the same object for the purpose of attribute merge.String
toString()
-
-
-
Constructor Detail
-
ExecutionAttribute
public ExecutionAttribute(String name)
Creates a newExecutionAttribute
bound to the provided type param.- Parameters:
name
- Descriptive name for the attribute, used primarily for debugging purposes.
-
-
Method Detail
-
derivedBuilder
public static <T,U> ExecutionAttribute.DerivedAttributeBuilder<T,U> derivedBuilder(String name, Class<T> attributeType, ExecutionAttribute<U> realAttribute)
Create an execution attribute whose value is derived from another attribute.Whenever this value is read, its value is read from a different "real" attribute, and whenever this value is written its value is written to the "real" attribute, instead.
This is useful when new attributes are created to replace old attributes, but for backwards-compatibility those old attributes still need to be made available.
- Parameters:
name
- The name of the attribute to createattributeType
- The type of the attribute being createdrealAttribute
- The "real" attribute from which this attribute is derived
-
equals
public boolean equals(Object o)
This override considers execution attributes with the same name to be the same object for the purpose of attribute merge.
-
-