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);",
fieldDeclaration.getType(),
fieldDeclaration.getSimpleName(),
modelRefType.getReferenceModelClassName());
if (classDeclaration.equals(fieldDeclaration.getDeclaringType())) {
throw new ValidationException(
MessageCode.SLIM3GEN1041,
env,
writeMethodDeclaration.getPosition(),
fieldDeclaration.getSimpleName(),
fieldDefinition);
}
throw new ValidationException(
MessageCode.SLIM3GEN1042,
env,
classDeclaration.getPosition(),
fieldDeclaration.getSimpleName(),
fieldDeclaration.getDeclaringType().getQualifiedName(),