/** * Creates a new type-converter form the {@link DynamoDBTypeConverted} * annotation if present. */ public <S> DynamoDBTypeConverter<S,T> typeConverter() { Annotation annotation = super.map.get(DynamoDBTypeConverted.class); if (annotation != null) { final DynamoDBTypeConverted converted = actualOf(DynamoDBTypeConverted.class); annotation = (converted == annotation ? null : annotation); return overrideOf(converted.converter(), targetType, annotation); } return null; }
private String environmentRevisionId; @DynamoDBTypeConverted(converter = InstantDDBConverter.class) private Instant createdTime; @DynamoDBTypeConverted(converter = AttributeDDBConverter.class) private Set<Attribute> attributes;
@Override public DynamoDBTypeConverter<?, ?> getTypeConverterForProperty(final String propertyName) { DynamoDBTypeConverted annotation = null; Method method = findMethod(propertyName); if (method != null) { annotation = method.getAnnotation(DynamoDBTypeConverted.class); } if (annotation == null) { Field field = findField(propertyName); if (field != null) { annotation = field.getAnnotation(DynamoDBTypeConverted.class); } } if (annotation != null) { try { return annotation.converter().getDeclaredConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new RuntimeException(e); } } return null; }
@DynamoDBTypeConverted(converter = InstantDDBConverter.class) private Instant createdTime; @DynamoDBTypeConverted(converter = InstantDDBConverter.class) private Instant lastUpdatedTime;
/** * Creates a new type-converter form the {@link DynamoDBTypeConverted} * annotation if present. */ public <S> DynamoDBTypeConverter<S,T> typeConverter() { Annotation annotation = super.map.get(DynamoDBTypeConverted.class); if (annotation != null) { final DynamoDBTypeConverted converted = actualOf(DynamoDBTypeConverted.class); annotation = (converted == annotation ? null : annotation); return overrideOf(converted.converter(), targetType, annotation); } return null; }