private void createHashCodeAndEquals(final JavaClass javaClass) { javaClass .addMethod( "public boolean equals(Object that) { " + "if (this == that) { return true; } " + "if (that == null) { return false; } " + "if (getClass() != that.getClass()) { return false; } " + "if (id != null) { return id.equals(((" + javaClass.getName() + ") that).id); } " + "return super.equals(that); " + "}") .addAnnotation(Override.class); javaClass .addMethod( "public int hashCode() { " + "if (id != null) { return id.hashCode(); } " + "return super.hashCode(); }") .addAnnotation(Override.class); }
@Override public JavaResource getTestJavaResource(final JavaClass javaClass) throws FileNotFoundException { return getTestJavaResource(javaClass.getPackage() + "." + javaClass.getName()); }