final Object testInstance = DefaultCreator.createInst(mc.getClazz());
// check initial value
if (Long.class.equals(type)) {
if (mf.getFieldValue(testInstance) != null) {
ve.add(new ConstraintViolation(Level.FATAL, mc, mf, getClass(),
"When using @" + Version.class.getSimpleName() + " on a Long field, it must be initialized to null."));
}
} else if (long.class.equals(type)) {
if ((Long) mf.getFieldValue(testInstance) != 0L) {
ve.add(new ConstraintViolation(Level.FATAL, mc, mf, getClass(),
"When using @" + Version.class.getSimpleName() + " on a long field, it must be initialized to 0."));
}
}
} else {
ve.add(new ConstraintViolation(Level.FATAL, mc, mf, getClass(),
"@" + Version.class.getSimpleName() + " can only be used on a Long/long field."));
}
}
}