@Override public final T unconvert(final String object) { return marshaller().unmarshall(targetType, object); }
@Override @SuppressWarnings({ "rawtypes", "unchecked" }) public Object unmarshall(AttributeValue value) { // TODO: Would be nice to cache this object, but not sure if we can // do that now without a breaking change; user's unmarshallers // might not all be thread-safe. DynamoDBMarshaller unmarshaller = createUnmarshaller(unmarshallerClass); return unmarshaller.unmarshall(targetClass, value.getS()); }
@Override public final T unconvert(final String object) { return marshaller().unmarshall(targetType, object); }
@Override @SuppressWarnings({ "rawtypes", "unchecked" }) public Object unmarshall(AttributeValue value) { // TODO: Would be nice to cache this object, but not sure if we can // do that now without a breaking change; user's unmarshallers // might not all be thread-safe. DynamoDBMarshaller unmarshaller = createUnmarshaller(unmarshallerClass); return unmarshaller.unmarshall(targetClass, value.getS()); }
@SuppressWarnings({ "rawtypes", "unchecked" }) private <T> T getCustomMarshalledValueSet(T toReturn, Method getter, AttributeValue value) { DynamoDBMarshalling annotation = getter.getAnnotation(DynamoDBMarshalling.class); Class<? extends DynamoDBMarshaller<? extends Object>> marshallerClass = annotation.marshallerClass(); DynamoDBMarshaller marshaller; try { marshaller = marshallerClass.newInstance(); } catch (InstantiationException e) { throw new DynamoDBMappingException("Couldn't instantiate marshaller of class " + marshallerClass, e); } catch (IllegalAccessException e) { throw new DynamoDBMappingException("Couldn't instantiate marshaller of class " + marshallerClass, e); } Set<T> set = new HashSet<T>(); for (String part : value.getSS()) { set.add((T) marshaller.unmarshall(getter.getReturnType(), part)); } return (T) set; }