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 DefaultValueTraitcreate(Supplier<?> supplier)Creates a newDefaultValueTraitwith a customSupplier.static DefaultValueTraitidempotencyToken()Creates a precannedDefaultValueTraitusing the idempotency token generation which creates a new UUID if a field is null.ObjectresolveValue(Object val)If the value is null then the default value supplier is used to get a default value for the field.TraitTypetype()The known trait type.
-
-
-
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 newDefaultValueTraitwith a customSupplier.- Parameters:
supplier- Supplier of default value for the field.- Returns:
- New trait instance.
-
idempotencyToken
public static DefaultValueTrait idempotencyToken()
Creates a precannedDefaultValueTraitusing 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.
-
-