Skip to content

Commit e3de5aa

Browse files
committed
Fxied DateFormat annotation issue
1 parent 2e927fe commit e3de5aa

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/main/java/org/javawebstack/abstractdata/mapper/DefaultMappers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public AbstractElement toAbstract(MapperContext context, Object value) throws Ma
263263

264264
public Object fromAbstract(MapperContext context, AbstractElement element, Class<?> type) throws MapperException {
265265
try {
266-
DateFormat df = context.getAnnotation(DateFormat.class);
266+
DateFormat df = context.getField().getAnnotation(DateFormat.class);
267267
Date date;
268268
if (df != null && df.epoch()) {
269269
long time = element.number(context.getMapper().isStrict()).longValue();

src/main/java/org/javawebstack/abstractdata/mapper/annotation/DateFormat.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package org.javawebstack.abstractdata.mapper.annotation;
22

3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
@Target(ElementType.FIELD)
9+
@Retention(RetentionPolicy.RUNTIME)
310
public @interface DateFormat {
411

512
String value() default "";

0 commit comments

Comments
 (0)