Class DefaultValueTrait
java.lang.Object
software.amazon.awssdk.core.traits.DefaultValueTrait
- All Implemented Interfaces:
Trait
Trait that supplies a default value when none is present for a given field.
-
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultValueTrait
Creates a newDefaultValueTrait
with a customSupplier
.static DefaultValueTrait
Creates a precannedDefaultValueTrait
using the idempotency token generation which creates a new UUID if a field is null.resolveValue
(Object val) If the value is null then the default value supplier is used to get a default value for the field.
-
Method Details
-
resolveValue
If the value is null then the default value supplier is used to get a default value for the field. Otherwise 'val' is returned.- Parameters:
val
- Value to resolve.- Returns:
- Resolved value.
-
create
Creates a newDefaultValueTrait
with a customSupplier
.- Parameters:
supplier
- Supplier of default value for the field.- Returns:
- New trait instance.
-
idempotencyToken
Creates a precannedDefaultValueTrait
using the idempotency token generation which creates a new UUID if a field is null. This is used when the 'idempotencyToken' trait in the service model is present.- Returns:
- New trait instance.
-