diff --git a/src/main/java/org/javawebstack/abstractdata/mapper/DefaultMappers.java b/src/main/java/org/javawebstack/abstractdata/mapper/DefaultMappers.java index 2ed0b60..0a7a682 100644 --- a/src/main/java/org/javawebstack/abstractdata/mapper/DefaultMappers.java +++ b/src/main/java/org/javawebstack/abstractdata/mapper/DefaultMappers.java @@ -263,7 +263,7 @@ public AbstractElement toAbstract(MapperContext context, Object value) throws Ma public Object fromAbstract(MapperContext context, AbstractElement element, Class type) throws MapperException { try { - DateFormat df = context.getAnnotation(DateFormat.class); + DateFormat df = context.getField().getAnnotation(DateFormat.class); Date date; if (df != null && df.epoch()) { long time = element.number(context.getMapper().isStrict()).longValue(); diff --git a/src/main/java/org/javawebstack/abstractdata/mapper/annotation/DateFormat.java b/src/main/java/org/javawebstack/abstractdata/mapper/annotation/DateFormat.java index bcedb86..d752599 100644 --- a/src/main/java/org/javawebstack/abstractdata/mapper/annotation/DateFormat.java +++ b/src/main/java/org/javawebstack/abstractdata/mapper/annotation/DateFormat.java @@ -1,5 +1,12 @@ package org.javawebstack.abstractdata.mapper.annotation; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) public @interface DateFormat { String value() default "";