@Retention(value=RUNTIME) @Target(value={TYPE,FIELD,METHOD,ANNOTATION_TYPE}) public @interface DynamoDBDelimited
String
attribute.
@DynamoDBDelimited( attributeNames={"areaCode","exchange","subscriber"}, delimiter='-' ) public PhoneNumber getPhoneNumber()
Where,
public class PhoneNumber { private String areaCode; private String exchange; private String subscriber; public String getAreaCode() { return areaCode; } public void setAreaCode(String areaCode) { this.areaCode = areaCode; } public String getExchange() { return exchange; } public void setExchange(String exchange) { this.exchange = exchange; } public String getSubscriber() { return subscriber; } public void setSubscriber(String subscriber) { this.subscriber = subscriber; } }
Would write,
PhoneNumber("206","266","1000")
= "206-266-1000"
PhoneNumber("206",null,"1000")
= "206--1000"
PhoneNumber("206",null,null)
= "206--"
PhoneNumber(null,"266","1000")
= "-266-1000"
PhoneNumber(null,"266",null)
= "-266-"
PhoneNumber(null,null,"1000")
= "--1000"
PhoneNumber(null,null,null)
= null
null
= null
""
= empty string not allowed by DDB but would produce empty object
"--"
= PhoneNumber(null,null,null)
"-----"
= PhoneNumber(null,null,null)
"206"
= PhoneNumber("206",null,null)
"206-266"
= PhoneNumber("206","266",null)
"206-266-1000-1234-5678"
= PhoneNumber("206","266","1000")
The converter does not protect against values which may also contain the
delimiter. If more advanced conversion is required, consider implementing,
a custom DynamoDBTypeConverter
.
New delimited values may always be appended to the string, however, there are some risks in distributed systems where, if one system has updated delimiting instructions and begins to persist new values, other systems, which also persist that same data, would effectively truncate it back to the original format.
Auto-generated annotations are not supported on field/property.
TYpe-converted annotations, annotated by DynamoDBTypeConverted
,
where the output type is String
are supported.
May be used as a meta-annotation.
Modifier and Type | Required Element and Description |
---|---|
String[] |
attributeNames
The ordered list of attribute/field names.
|
Modifier and Type | Optional Element and Description |
---|---|
char |
delimiter
The delimiter for separating attribute values; default is
| . |
public abstract String[] attributeNames
Copyright © 2013 Amazon Web Services, Inc. All Rights Reserved.