@Override public AttributeValue marshall(Object obj) { Boolean bool = (Boolean) obj; if (bool == null || bool == false) { return new AttributeValue().withN("0"); } else { return new AttributeValue().withN("1"); } } }
@Override public AttributeValue marshall(Object obj) { String string = (String) obj; if (string.length() == 0) { // Sticking with the legacy behavior for now. return null; } return new AttributeValue().withS(string); } }
@Override public AttributeValue marshall(Object obj) { @SuppressWarnings("unchecked") Set<String> set = (Set<String>) obj; List<String> strings = new ArrayList<String>(set.size()); for (String s : set) { strings.add(s); } return new AttributeValue().withSS(strings); } }
@Override public AttributeValue marshall(Object obj) { @SuppressWarnings("unchecked") Set<? extends Number> numbers = (Set<? extends Number>) obj; List<String> numberAttributes = new ArrayList<String>(numbers.size()); for (Number n : numbers) { numberAttributes.add(n.toString()); } return new AttributeValue().withNS(numberAttributes); } }
@Override public AttributeValue marshall(Object obj) { Number number = (Number) obj; return new AttributeValue().withN(number.toString()); } }
@Override public AttributeValue marshall(Object obj) { @SuppressWarnings("unchecked") Set<byte[]> buffers = (Set<byte[]>) obj; List<ByteBuffer> attributes = new ArrayList<ByteBuffer>(buffers.size()); for (byte[] b : buffers) { attributes.add(ByteBuffer.wrap(b)); } return new AttributeValue().withBS(attributes); } }
@Override public AttributeValue marshall(Object obj) { return new AttributeValue().withB((ByteBuffer) obj); } }
@Override public AttributeValue marshall(Object obj) { return new AttributeValue().withBOOL((Boolean) obj); } }
@Override public AttributeValue convert(final S o) { final AttributeValue value = new AttributeValue(); set(value, o); return value; } @Override
@Override public AttributeValue marshall(Object obj) { return new AttributeValue().withB(ByteBuffer.wrap((byte[]) obj)); } }
private static Map<String, AttributeValue> createAttributes(Map<String, ByteIterator> values) { Map<String, AttributeValue> attributes = new HashMap<>(values.size() + 1); for (Entry<String, ByteIterator> val : values.entrySet()) { attributes.put(val.getKey(), new AttributeValue(val.getValue().toString())); } return attributes; }
@Override public AttributeValue marshall(Object obj) { return new AttributeValue().withS(obj.toString()); } }
@Override public AttributeValue marshall(Object obj) { @SuppressWarnings("unchecked") Set<UUID> uuids = (Set<UUID>) obj; List<String> strings = new ArrayList<String>(uuids.size()); for (UUID uuid : uuids) { strings.add(uuid.toString()); } return new AttributeValue().withSS(strings); } }
@Override public AttributeValue marshall(Object obj) { @SuppressWarnings("unchecked") Set<ByteBuffer> buffers = (Set<ByteBuffer>) obj; List<ByteBuffer> attributes = new ArrayList<ByteBuffer>(buffers.size()); for (ByteBuffer b : buffers) { attributes.add(b); } return new AttributeValue().withBS(attributes); } }
@Override public AttributeValue marshall(Object obj) { @SuppressWarnings("unchecked") Set<Calendar> dates = (Set<Calendar>) obj; List<String> timestamps = new ArrayList<String>(dates.size()); for (Calendar date : dates) { timestamps.add(DateUtils.formatISO8601Date(date.getTime())); } return new AttributeValue().withSS(timestamps); } }
@Override public AttributeValue marshall(Object obj) { @SuppressWarnings("unchecked") Set<Date> dates = (Set<Date>) obj; List<String> timestamps = new ArrayList<String>(dates.size()); for (Date date : dates) { timestamps.add(DateUtils.formatISO8601Date(date)); } return new AttributeValue().withSS(timestamps); } }
@Override public AttributeValue marshall(Object obj) { return new AttributeValue().withS( DateUtils.formatISO8601Date(((Calendar) obj).getTime())); } }
@Override public AttributeValue marshall(Object obj) { return new AttributeValue().withS( DateUtils.formatISO8601Date((Date) obj)); } }
@Override public AttributeValue marshall(Object obj) { Map<String, AttributeValue> values = converter.convert(obj); return new AttributeValue().withM(values); } }
@Override public AttributeValue marshall(Object obj) { S3Link s3link = (S3Link) obj; if ( s3link.getBucketName() == null || s3link.getKey() == null ) { // insufficient S3 resource specification return null; } return new AttributeValue().withS(s3link.toJson()); } }