Class DefaultValueTrait
- java.lang.Object
-
- software.amazon.awssdk.core.traits.DefaultValueTrait
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DefaultValueTrait
create(Supplier<?> supplier)
Creates a newDefaultValueTrait
with a customSupplier
.static DefaultValueTrait
idempotencyToken()
Creates a precannedDefaultValueTrait
using the idempotency token generation which creates a new UUID if a field is null.Object
resolveValue(Object val)
If the value is null then the default value supplier is used to get a default value for the field.
-
-
-
Method Detail
-
resolveValue
public Object resolveValue(Object val)
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
public static DefaultValueTrait create(Supplier<?> supplier)
Creates a newDefaultValueTrait
with a customSupplier
.- Parameters:
supplier
- Supplier of default value for the field.- Returns:
- New trait instance.
-
idempotencyToken
public static DefaultValueTrait 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.
-
-