2020import com .amplifyframework .core .model .Model ;
2121import com .amplifyframework .core .model .temporal .Temporal ;
2222
23+ import java .util .Date ;
24+
2325/**
2426 * Enumerate the types used in the fields
2527 * of {@link com.amplifyframework.core.model.Model} classes.
@@ -28,86 +30,83 @@ public enum JavaFieldType {
2830 /**
2931 * Represents the boolean data type.
3032 */
31- BOOLEAN (Boolean .class . getSimpleName () ),
33+ BOOLEAN (Boolean .class ),
3234
3335 /**
3436 * Represents the int data type.
3537 */
36- INTEGER (Integer .class . getSimpleName () ),
38+ INTEGER (Integer .class ),
3739
3840 /**
3941 * Represents the long data type.
4042 */
41- LONG (Long .class . getSimpleName () ),
43+ LONG (Long .class ),
4244
4345 /**
4446 * Represents the float data type.
4547 */
46- FLOAT (Float .class . getSimpleName () ),
48+ FLOAT (Float .class ),
4749
4850 /**
4951 * Represents the String data type.
5052 */
51- STRING (String .class .getSimpleName ()),
53+ STRING (String .class ),
54+
55+ /**
56+ * Represents the java.lang.Date data type.
57+ */
58+ JAVA_DATE (Date .class ),
5259
5360 /**
5461 * Represents the Date data type.
5562 */
56- DATE (Temporal .Date .class . getSimpleName () ),
63+ DATE (Temporal .Date .class ),
5764
5865 /**
5966 * Represents the DateTime data type.
6067 */
61- DATE_TIME (Temporal .DateTime .class . getSimpleName () ),
68+ DATE_TIME (Temporal .DateTime .class ),
6269
6370 /**
6471 * Represents the Time data type.
6572 */
66- TIME (Temporal .Time .class . getSimpleName () ),
73+ TIME (Temporal .Time .class ),
6774
6875 /**
6976 * Represents the Timestamp data type.
7077 */
71- TIMESTAMP (Temporal .Timestamp .class . getSimpleName () ),
78+ TIMESTAMP (Temporal .Timestamp .class ),
7279
7380 /**
7481 * Represents the Enum type.
7582 */
76- ENUM (Enum .class . getSimpleName () ),
83+ ENUM (Enum .class ),
7784
7885 /**
7986 * Represents the Model type.
8087 */
81- MODEL (Model .class . getSimpleName () ),
88+ MODEL (Model .class ),
8289
8390 /**
8491 * Represents any custom type (objects that are not models).
8592 */
86- CUSTOM_TYPE (Object .class . getSimpleName () );
93+ CUSTOM_TYPE (Object .class );
8794
88- private final String javaFieldType ;
95+ private final Class <?> javaFieldType ;
8996
90- JavaFieldType (@ NonNull String javaFieldType ) {
97+ JavaFieldType (@ NonNull Class <?> javaFieldType ) {
9198 this .javaFieldType = javaFieldType ;
9299 }
93100
94- /**
95- * Return the string that represents the value of the enumeration constant.
96- * @return the string that represents the value of the enumeration constant.
97- */
98- public String stringValue () {
99- return this .javaFieldType ;
100- }
101-
102101 /**
103102 * Construct and return the JavaFieldType enumeration for the given string
104103 * representation of the field type.
105104 * @param javaFieldType the string representation of the field type.
106105 * @return the enumeration constant.
107106 */
108- public static JavaFieldType from (@ NonNull String javaFieldType ) {
107+ public static JavaFieldType from (@ NonNull Class <?> javaFieldType ) {
109108 for (final JavaFieldType type : JavaFieldType .values ()) {
110- if (javaFieldType .equals (type .stringValue () )) {
109+ if (javaFieldType .equals (type .javaFieldType )) {
111110 return type ;
112111 }
113112 }
0 commit comments