use of org.drools.javaparser.ast.type.PrimitiveType in project drools by kiegroup.
the class POJOGenerator method generateEqualsForField.
private static Statement generateEqualsForField(MethodDeclaration getter, String fieldName) {
Type type = getter.getType();
Statement statement;
if (type instanceof ClassOrInterfaceType) {
statement = parseStatement(" if( __fieldName != null ? !__fieldName.equals(that.__fieldName) : that.__fieldName != null) { return false; }");
} else if (type instanceof PrimitiveType) {
statement = parseStatement(" if( __fieldName != that.__fieldName) { return false; }");
} else {
throw new RuntimeException("Unknown type");
}
return replaceFieldName(statement, fieldName);
}
Aggregations