From 838b42fa3ceb19bad0f31ee48cd6b3fc330ad158 Mon Sep 17 00:00:00 2001 From: chuyan <1047381936@qq.com> Date: Sun, 1 Mar 2020 15:44:23 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ase/model/activity/Activity.java | 3 +-- .../ase/validator/TestNullValueValidator.java | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/codesdream/ase/validator/TestNullValueValidator.java diff --git a/src/main/java/com/codesdream/ase/model/activity/Activity.java b/src/main/java/com/codesdream/ase/model/activity/Activity.java index 2a0b4f2..6359756 100644 --- a/src/main/java/com/codesdream/ase/model/activity/Activity.java +++ b/src/main/java/com/codesdream/ase/model/activity/Activity.java @@ -137,11 +137,10 @@ public class Activity { //提前提醒时间 @Column(name = "remind_time", nullable = true) - @Temporal(TemporalType.TIMESTAMP) private LocalDateTime remindTime; //附件组(名字) - @ElementCollection(targetClass = java.lang.String.class) + @ElementCollection(targetClass = String.class) private List enclosures; //主要负责人 diff --git a/src/main/java/com/codesdream/ase/validator/TestNullValueValidator.java b/src/main/java/com/codesdream/ase/validator/TestNullValueValidator.java new file mode 100644 index 0000000..a7c4a84 --- /dev/null +++ b/src/main/java/com/codesdream/ase/validator/TestNullValueValidator.java @@ -0,0 +1,27 @@ +package com.codesdream.ase.validator; + +import com.codesdream.ase.model.activity.Activity; +import javafx.beans.binding.ObjectExpression; + +import java.lang.reflect.Field; + +public class TestNullValueValidator { + + public static void main(String[] args){ + Activity activity = new Activity(); + TestNullValueValidator.run(activity); + + } + + static void run(Object object){ + Field[] fields = object.getClass().getDeclaredFields(); + for (Field field : fields){ + String name = field.getName(); + name = name.substring(0,1).toUpperCase()+name.substring(1); + String type = field.getGenericType().toString(); + System.out.println("name: " + name); + System.out.println("Type: " + type); + System.out.println(); + } + } +}