From 92d7a7562f30e85bc2956524fba17d51b6414f0a Mon Sep 17 00:00:00 2001 From: rbygrave Date: Thu, 29 Jul 2021 11:49:01 +1200 Subject: [PATCH] Tidy only - no functional change to MutableHash and BeanPropertyJsonMapper --- .../main/java/io/ebean/bean/MutableHash.java | 17 +++++++++-------- .../server/deploy/BeanPropertyJsonMapper.java | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ebean-api/src/main/java/io/ebean/bean/MutableHash.java b/ebean-api/src/main/java/io/ebean/bean/MutableHash.java index aa5ea29df..d59421980 100644 --- a/ebean-api/src/main/java/io/ebean/bean/MutableHash.java +++ b/ebean-api/src/main/java/io/ebean/bean/MutableHash.java @@ -4,25 +4,26 @@ package io.ebean.bean; * Interface to for mutable information in EntityBeanIntercept. */ public interface MutableHash { - + /** - * Compares the given json to an internal value. Can be a MD5 hash or a plain JSON string. + * Compares the given json to an internal value. Can be a MD5 hash or a plain JSON string. + * * @return true if the value matches the hash. */ boolean isEqualToJson(String json); /** - * Compares the given object to an internal value. This is an optional method, but required for proper changelog/beanState support. + * Compares the given object to an internal value. Required for proper changelog/beanState support. * The implementation can serialize the object and compare it against the original json. */ - default boolean isEqualToObject(Object obj) { - return true; - } + boolean isEqualToObject(Object obj); + /** - * Creates a new instance from the internal json string. This is an optional method. + * Creates a new instance from the internal json string. + *

+ * This is used to provide an original/old value for change logging / persist listeners. */ default Object get() { return null; } } - \ No newline at end of file diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanPropertyJsonMapper.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanPropertyJsonMapper.java index 747df5130..b1838ff18 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanPropertyJsonMapper.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanPropertyJsonMapper.java @@ -96,11 +96,11 @@ public class BeanPropertyJsonMapper extends BeanProperty { private static class JsonMutableHash implements MutableHash { private final String originalJson; - private ScalarType parent; + private final ScalarType parent; JsonMutableHash(ScalarType parent, String json) { this.parent = parent; - originalJson = json; + this.originalJson = json; } @Override