MethodDeclaration writeMethodDeclaration) {
if (readMethodDeclaration == null) {
String expectedReadMethodName =
FieldDeclarationUtil.getReadMethodName(fieldDeclaration);
if (classDeclaration.equals(fieldDeclaration.getDeclaringType())) {
throw new ValidationException(
MessageCode.SLIM3GEN1011,
env,
fieldDeclaration.getPosition(),
expectedReadMethodName);
}
throw new ValidationException(
MessageCode.SLIM3GEN1024,
env,
classDeclaration.getPosition(),
expectedReadMethodName,
fieldDeclaration.getSimpleName(),
fieldDeclaration.getDeclaringType().getQualifiedName());
}
if (writeMethodDeclaration != null) {
String fieldDefinition =
String.format(
"%1$s %2$s = new %1$s(%3$s.class, \"xxx\", this);",
fieldDeclaration.getType(),
fieldDeclaration.getSimpleName(),
inverseModelRefType.getReferenceModelClassName());
if (classDeclaration.equals(fieldDeclaration.getDeclaringType())) {
throw new ValidationException(
MessageCode.SLIM3GEN1039,
env,
writeMethodDeclaration.getPosition(),
fieldDeclaration.getSimpleName(),
fieldDefinition,
classDeclaration.getSimpleName(),
inverseModelRefType.getReferenceModelClassName());
}
throw new ValidationException(
MessageCode.SLIM3GEN1040,
env,
classDeclaration.getPosition(),
fieldDeclaration.getSimpleName(),
fieldDeclaration.getDeclaringType().getQualifiedName(),