From df92538ab3d83da9839f08b28fc8a67317565463 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 3 Aug 2013 20:21:19 +0200 Subject: wip --- .../main/java/io/trygvis/persistence/FieldMirror.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'container-compiler-plugin/src/main/java/io/trygvis/persistence/FieldMirror.java') diff --git a/container-compiler-plugin/src/main/java/io/trygvis/persistence/FieldMirror.java b/container-compiler-plugin/src/main/java/io/trygvis/persistence/FieldMirror.java index bf0a0c3..f92cc2c 100644 --- a/container-compiler-plugin/src/main/java/io/trygvis/persistence/FieldMirror.java +++ b/container-compiler-plugin/src/main/java/io/trygvis/persistence/FieldMirror.java @@ -15,24 +15,26 @@ public abstract class FieldMirror { public final String sqlName; public final boolean id; public final boolean notNull; + public final boolean unique; public enum FieldType { PRIMITIVE, REFERENCE, } - protected FieldMirror(FieldType fieldType, TypeRef type, String javaName, String sqlName, boolean id, boolean notNull) { + protected FieldMirror(FieldType fieldType, TypeRef type, String javaName, String sqlName, boolean id, boolean notNull, boolean unique) { this.fieldType = fieldType; this.type = type; this.javaName = javaName; this.sqlName = sqlName; this.id = id; this.notNull = notNull; + this.unique = unique; } public static class PrimitiveFieldMirror extends FieldMirror { - public PrimitiveFieldMirror(TypeRef typeRef, String javaName, String sqlName, boolean id, boolean notNull) { - super(PRIMITIVE, typeRef, javaName, sqlName, id, notNull); + public PrimitiveFieldMirror(TypeRef typeRef, String javaName, String sqlName, boolean id, boolean notNull, boolean unique) { + super(PRIMITIVE, typeRef, javaName, sqlName, id, notNull, unique); } @Override @@ -42,13 +44,14 @@ public abstract class FieldMirror { ", javaName='" + javaName + '\'' + ", sqlName='" + sqlName + '\'' + ", notNull=" + notNull + + ", unique=" + unique + '}'; } } - public static class ReferenceFieldMirror extends FieldMirror { - public ReferenceFieldMirror(TypeRef typeRef, String javaName, String sqlName, boolean notNull) { - super(REFERENCE, typeRef, javaName, sqlName, false, notNull); + public static class ReferenceFieldMirror extends FieldMirror { + public ReferenceFieldMirror(TypeRef typeRef, String javaName, String sqlName, boolean notNull, boolean unique) { + super(REFERENCE, typeRef, javaName, sqlName, false, notNull, unique); } @Override @@ -58,6 +61,7 @@ public abstract class FieldMirror { ", javaName='" + javaName + '\'' + ", sqlName='" + sqlName + '\'' + ", notNull=" + notNull + + ", unique=" + unique + '}'; } } -- cgit v1.2.3