public final class ItemUtils extends Object
Item
and AttributeValue
objects.Modifier and Type | Method and Description |
---|---|
static void |
checkInvalidAttribute(String attrName,
Object val) |
static void |
checkInvalidAttrName(String attrName) |
static Map<String,AttributeValue> |
fromSimpleMap(Map<String,Object> map)
Converts a map of string to simple objects into the low-level
representation; or null if the input is null.
|
static Integer |
minimum(Integer one,
Integer two)
Returns the minimum of the two input integers taking null into account.
|
static Map<String,Condition> |
toAttributeConditionMap(Collection<? extends Filter<?>> filters)
Returns the low level representation of a collection of
Filter . |
static AttributeValue |
toAttributeValue(Object value)
Converts a simple value into the low-level
|
static Map<String,AttributeValue> |
toAttributeValueMap(Collection<KeyAttribute> primaryKey)
Converts the specified primary key into the low-level representation.
|
static Map<String,AttributeValue> |
toAttributeValueMap(KeyAttribute... primaryKey)
Converts the specified primary key into the low-level representation.
|
static Map<String,AttributeValue> |
toAttributeValueMap(PrimaryKey primaryKey)
Converts the specified primary key into the low-level representation.
|
static Map<String,AttributeValue> |
toAttributeValues(Item item)
Converts an
Item into the low-level representation;
or null if the input is null. |
static AttributeValue[] |
toAttributeValues(Object[] values)
Converts the input array of values into an array of low level
representation of those values.
|
static Map<String,AttributeValueUpdate> |
toAttributeValueUpdate(List<AttributeUpdate> attributesToUpdate)
Converts a list of
AttributeUpdate into the low-level
representation; or null if the input is null. |
static BigDecimal |
toBigDecimal(Number n)
Converts a number into BigDecimal representation.
|
static Set<BigDecimal> |
toBigDecimalSet(Number... val) |
static Set<BigDecimal> |
toBigDecimalSet(Set<Number> vals) |
static Map<String,ExpectedAttributeValue> |
toExpectedAttributeValueMap(Collection<Expected> expectedSet)
Returns the low level representation of a collection of
Expected . |
static Item |
toItem(Map<String,AttributeValue> item)
Returns an
Item given the low level item information;
or null if the input is null; |
static List<Item> |
toItemList(List<Map<String,AttributeValue>> items)
Returns a non-null list of
Item 's given the low level
list of item information. |
static List<Object> |
toSimpleList(List<AttributeValue> attrValues)
Converts a list of low-level
AttributeValue into a list of
simple values. |
static <T> List<T> |
toSimpleListValue(List<AttributeValue> values)
Convenient method to convert a list of low-level
AttributeValue into a list of values of the same type T. |
static <T> Map<String,T> |
toSimpleMapValue(Map<String,AttributeValue> values) |
static <T> T |
toSimpleValue(AttributeValue value)
Converts a low-level
AttributeValue into a simple value,
which can be one of the followings:
String
Set<String>
Number (including any subtypes and primitive types)
Set<Number>
byte[]
Set<byte[]>
ByteBuffer
Set<ByteBuffer>
Boolean or boolean
null
Map<String,T>, where T can be any type on this list but must not
induce any circular reference
List<T>, where T can be any type on this list but must not induce
any circular reference
|
static String |
valToString(Object val)
Returns the string representation of the given value; or null if the
value is null.
|
public static Item toItem(Map<String,AttributeValue> item)
Item
given the low level item information;
or null if the input is null;public static List<Item> toItemList(List<Map<String,AttributeValue>> items)
Item
's given the low level
list of item information.public static Map<String,AttributeValue> toAttributeValues(Item item)
Item
into the low-level representation;
or null if the input is null.public static Map<String,AttributeValue> fromSimpleMap(Map<String,Object> map)
public static Map<String,AttributeValueUpdate> toAttributeValueUpdate(List<AttributeUpdate> attributesToUpdate)
AttributeUpdate
into the low-level
representation; or null if the input is null.public static AttributeValue toAttributeValue(Object value)
representation.
value
- the given value which can be one of the followings:
UnsupportedOperationException
- if the input object type is not supportedpublic static List<Object> toSimpleList(List<AttributeValue> attrValues)
AttributeValue
into a list of
simple values. Each value in the returned list can be one of the
followings:
public static <T> List<T> toSimpleListValue(List<AttributeValue> values)
AttributeValue
into a list of values of the same type T.
Each value in the returned list can be one of the followings:
public static <T> Map<String,T> toSimpleMapValue(Map<String,AttributeValue> values)
public static String valToString(Object val)
BigDecimal
it will be the string
representation without an exponent field.public static <T> T toSimpleValue(AttributeValue value)
AttributeValue
into a simple value,
which can be one of the followings:
IllegalArgumentException
- if an empty AttributeValue
value is specifiedpublic static Integer minimum(Integer one, Integer two)
public static Map<String,ExpectedAttributeValue> toExpectedAttributeValueMap(Collection<Expected> expectedSet)
Expected
.public static Map<String,Condition> toAttributeConditionMap(Collection<? extends Filter<?>> filters)
Filter
.public static AttributeValue[] toAttributeValues(Object[] values)
public static Map<String,AttributeValue> toAttributeValueMap(Collection<KeyAttribute> primaryKey)
public static Map<String,AttributeValue> toAttributeValueMap(PrimaryKey primaryKey)
public static Map<String,AttributeValue> toAttributeValueMap(KeyAttribute... primaryKey)
public static BigDecimal toBigDecimal(Number n)
public static Set<BigDecimal> toBigDecimalSet(Number... val)
public static Set<BigDecimal> toBigDecimalSet(Set<Number> vals)
public static void checkInvalidAttrName(String attrName)
Copyright © 2013 Amazon Web Services, Inc. All Rights Reserved.