Class SdkField<TypeT>
java.lang.Object
software.amazon.awssdk.core.SdkField<TypeT>
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <TypeT> SdkField.Builder<TypeT> builder(MarshallingType<? super TypeT> marshallingType) Creates a new instance ofSdkField.Builderbound to the specified type.booleancontainsTrait(Class<? extends Trait> clzz) Checks if a givenTraitis present on the field.booleancontainsTrait(Class<? extends Trait> clzz, TraitType type) Checks if a givenTraitis present on the field.getOptionalTrait(Class<T> clzz) Gets the trait of the specified class if available.getOptionalTrait(Class<T> clzz, TraitType type) Gets the trait of the specified class if available.<T extends Trait>
TgetRequiredTrait(Class<T> clzz) Gets the trait of the specified class, or throwIllegalStateExceptionif not available.<T extends Trait>
TgetRequiredTrait(Class<T> clzz, TraitType type) Gets the trait of the specified class, or throwIllegalStateExceptionif not available.<T extends Trait>
TGets the trait of the specified class if available.<T extends Trait>
TGets the trait of the specified class and known type if available.getValueOrDefault(Object pojo) Retrieves the current value of 'this' field from the given POJO.booleanlocation()MarshallingType<? super TypeT> voidSets the given value on the POJO via the setter passed into theSdkField.Builder.
-
Method Details
-
memberName
-
marshallingType
- Returns:
- MarshallingType of member. Used primarily for marshaller/unmarshaller lookups.
-
location
- Returns:
- Location the member should be marshalled into (i.e. headers/query/path/payload).
-
locationName
- Returns:
- The location name to use when marshalling. I.E. the field name of the JSON document, or the header name, etc.
-
ignoreDataTypeConversionFailures
public boolean ignoreDataTypeConversionFailures()- Returns:
- whether data-type conversion errors are to be ignored
-
unmarshallLocationName
- Returns:
- The location name to use when unmarshalling. This is only needed for AWS/Query or EC2 services. All
other services should use
locationNamefor both marshalling and unmarshalling.
-
constructor
-
getTrait
-
getTrait
Gets the trait of the specified class and known type if available.- Type Parameters:
T- Type of trait.- Parameters:
clzz- Trait class to get.type- TheTraitTypefor this trait.- Returns:
- Trait instance or null if trait is not present.
-
getOptionalTrait
-
getOptionalTrait
-
getRequiredTrait
Gets the trait of the specified class, or throwIllegalStateExceptionif not available.- Type Parameters:
T- Type of trait.- Parameters:
clzz- Trait class to get.- Returns:
- Trait instance.
- Throws:
IllegalStateException- if trait is not present.
-
getRequiredTrait
public <T extends Trait> T getRequiredTrait(Class<T> clzz, TraitType type) throws IllegalStateException Gets the trait of the specified class, or throwIllegalStateExceptionif not available.- Type Parameters:
T- Type of trait.- Parameters:
clzz- Trait class to get.type- TheTraitTypefor this trait.- Returns:
- Trait instance.
- Throws:
IllegalStateException- if trait is not present.
-
containsTrait
-
containsTrait
-
getValueOrDefault
Retrieves the current value of 'this' field from the given POJO. Uses the getter passed into theSdkField.Builder. If the current value is null this method will look for theDefaultValueTraiton the field and attempt to resolve a default value. If theDefaultValueTraitis not present this just returns null.- Parameters:
pojo- POJO to retrieve value from.- Returns:
- Current value of 'this' field in the POJO or default value if current value is null.
-
set
Sets the given value on the POJO via the setter passed into theSdkField.Builder.- Parameters:
pojo- POJO containing field to set.val- Value of field.
-
builder
public static <TypeT> SdkField.Builder<TypeT> builder(MarshallingType<? super TypeT> marshallingType) Creates a new instance ofSdkField.Builderbound to the specified type.- Type Parameters:
TypeT- Type of field. Must be a subtype of theMarshallingTypetype param.- Parameters:
marshallingType- Type of field.- Returns:
- New builder instance.
-