@@ -0,0 +1,1165 @@
+/**%0A * %0A */%0Apackage com.google.code.morphia.mapping.validation.fieldrules;%0A%0Aimport java.util.Set;%0A%0Aimport com.google.code.morphia.annotations.Embedded;%0Aimport com.google.code.morphia.annotations.Id;%0Aimport com.google.code.morphia.annotations.Property;%0Aimport com.google.code.morphia.annotations.Reference;%0Aimport com.google.code.morphia.mapping.MappedClass;%0Aimport com.google.code.morphia.mapping.MappedField;%0Aimport com.google.code.morphia.mapping.validation.ConstraintViolation;%0Aimport com.google.code.morphia.mapping.validation.ConstraintViolation.Level;%0A%0A/** @author ScottHenandez */%0Apublic class IdDoesNotMix extends FieldConstraint %7B%0A%0A%09@Override%0A%09protected void check(MappedClass mc, MappedField mf, Set%3CConstraintViolation%3E ve) %7B%0A%09%09// an @Id field can not be a Value, Reference, or Embedded%0A%09%09if (mf.hasAnnotation(Id.class))%0A%09%09%09if(mf.hasAnnotation(Reference.class) %7C%7C mf.hasAnnotation(Embedded.class) %7C%7C mf.hasAnnotation(Property.class))%0A%09%09%09%09ve.add(new ConstraintViolation(Level.FATAL, mc, mf, this.getClass(), mf.getFullName() + %22 is annotated as @%22%0A%09%09%09%09%09%09+ Id.class.getSimpleName() + %22 and cannot be mixed with other annotations (like @Reference)%22));%0A%09%7D%0A%7D%0A

test to make sure people don't mix @Id with @Reference/Embedded/Property