From 18d7fc0bdc5b9b6b7f3de538a0a91485008df700 Mon Sep 17 00:00:00 2001 From: andrebrowne <42154231+andrebrowne@users.noreply.github.com> Date: Sat, 8 Aug 2020 21:05:32 -0400 Subject: [PATCH] BAEL-4077 Fixup styling --- persistence-modules/java-jpa-3/pom.xml | 56 ------------------- .../jpa/equality/EqualByBusinessKey.java | 14 +++-- .../com/baeldung/jpa/equality/EqualById.java | 13 +++-- .../jpa/equality/EqualByJavaDefault.java | 4 +- .../jpa/equality/EqualityUnitTest.java | 2 +- 5 files changed, 17 insertions(+), 72 deletions(-) diff --git a/persistence-modules/java-jpa-3/pom.xml b/persistence-modules/java-jpa-3/pom.xml index 562f337215..da18ae3046 100644 --- a/persistence-modules/java-jpa-3/pom.xml +++ b/persistence-modules/java-jpa-3/pom.xml @@ -66,62 +66,6 @@ -proc:none - - org.bsc.maven - maven-processor-plugin - ${maven-processor-plugin.version} - - - process - - process - - generate-sources - - target/metamodel - - org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - ${build-helper-maven-plugin.version} - - - add-source - generate-sources - - add-source - - - - target/metamodel - ${project.build.directory}/generated-sources/java/ - - - - - - - com.mysema.maven - apt-maven-plugin - 1.1.3 - - - - process - - - target/generated-sources/java - com.querydsl.apt.jpa.JPAAnnotationProcessor - - - - diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java index 3e34f97d77..655db4e575 100644 --- a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java @@ -40,15 +40,17 @@ public class EqualByBusinessKey { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (obj instanceof EqualByBusinessKey) - if (((EqualByBusinessKey) obj).getEmail() == getEmail()) + } + if (obj instanceof EqualByBusinessKey) { + if (((EqualByBusinessKey) obj).getEmail() == getEmail()) { return true; - + } + } return false; } - } diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java index f29a152f3e..cebfb5fcec 100644 --- a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java @@ -41,14 +41,15 @@ public class EqualById { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (obj instanceof EqualById) - return ((EqualById) obj).getId() == getId(); - + } + if (obj instanceof EqualById) { + return ((EqualById) obj).getId().equals(getId()); + } return false; } - } diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java index 04a81865c6..b312845b61 100644 --- a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java @@ -30,9 +30,7 @@ public class EqualByJavaDefault implements Cloneable{ this.email = email; } - public Object clone() throws - CloneNotSupportedException - { + public Object clone() throws CloneNotSupportedException { return super.clone(); } } diff --git a/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java index c672c9e460..03ac11b6fd 100644 --- a/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java +++ b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java @@ -71,4 +71,4 @@ public class EqualityUnitTest { Assert.assertEquals(object1, object2); Assert.assertNotEquals(object1.getId(), object2.getId()); } -} \ No newline at end of file +}