Class NestedAttributeName
- java.lang.Object
-
- software.amazon.awssdk.enhanced.dynamodb.NestedAttributeName
-
@ThreadSafe public final class NestedAttributeName extends Object
A high-level representation of a DynamoDB nested attribute name that can be used in various situations where the API requires or accepts a nested attribute name. The nested attributes are represented by a list of strings where each element corresponds to a nesting level. A simple (top-level) attribute name can be represented by creating an instance with a single string element.NestedAttributeName is used directly in
QueryEnhancedRequest.nestedAttributesToProject()
andScanEnhancedRequest.nestedAttributesToProject()
, and indirectly byQueryEnhancedRequest.attributesToProject()
andScanEnhancedRequest.attributesToProject()
.Examples of creating NestedAttributeNames:
- Simple attribute
Level0
can be created asNestedAttributeName.create("Level0")
- Nested attribute
Level0.Level1
can be created asNestedAttributeName.create("Level0", "Level1")
- Nested attribute
Level0.Level-2
can be created asNestedAttributeName.create("Level0", "Level-2")
- List item 0 of
ListAttribute
can be created asNestedAttributeName.create("ListAttribute[0]")
- Simple attribute
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NestedAttributeName.Builder
A builder forNestedAttributeName
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NestedAttributeName.Builder
builder()
Create a builder that can be used to create aNestedAttributeName
.static NestedAttributeName
create(String element)
Creates a NestedAttributeName with a single element, which is effectively just a simple attribute name without nesting.static NestedAttributeName
create(String... elements)
Creates a NestedAttributeName from a list of elements that compose the full path of the nested attribute.static NestedAttributeName
create(List<String> elements)
Creates a NestedAttributeName from a list of elements that compose the full path of the nested attribute.List<String>
elements()
Gets elements of NestedAttributeName in the form of List.boolean
equals(Object o)
int
hashCode()
NestedAttributeName.Builder
toBuilder()
Returns a builder initialized with all existing values on the request object.String
toString()
-
-
-
Method Detail
-
create
public static NestedAttributeName create(String element)
Creates a NestedAttributeName with a single element, which is effectively just a simple attribute name without nesting.Example:create("foo") will create NestedAttributeName corresponding to Attribute foo.
- Parameters:
element
- Attribute Name. Single String represents just a simple attribute name without nesting.- Returns:
- NestedAttributeName with attribute name as specified element.
-
create
public static NestedAttributeName create(String... elements)
Creates a NestedAttributeName from a list of elements that compose the full path of the nested attribute.Example:create("foo", "bar") will create NestedAttributeName which represents foo.bar nested attribute.
- Parameters:
elements
- Nested Attribute Names. Each of strings in varargs represent the nested attribute name at subsequent levels.- Returns:
- NestedAttributeName with Nested attribute name set as specified in elements var args.
-
create
public static NestedAttributeName create(List<String> elements)
Creates a NestedAttributeName from a list of elements that compose the full path of the nested attribute.Example:create(Arrays.asList("foo", "bar")) will create NestedAttributeName which represents foo.bar nested attribute.
- Parameters:
elements
- List of Nested Attribute Names. Each of strings in List represent the nested attribute name at subsequent levels.- Returns:
- NestedAttributeName with Nested attribute name set as specified in elements Collections.
-
builder
public static NestedAttributeName.Builder builder()
Create a builder that can be used to create aNestedAttributeName
.
-
elements
public List<String> elements()
Gets elements of NestedAttributeName in the form of List. Each element in the list corresponds to the subsequent Nested Attribute name.- Returns:
- List of nested attributes, each entry in the list represent one level of nesting. Example, A Two level Attribute name foo.bar will be represented as ["foo", "bar"]
-
toBuilder
public NestedAttributeName.Builder toBuilder()
Returns a builder initialized with all existing values on the request object.
-
-