diff --git a/src/main/java/io/ebeaninternal/server/deploy/BeanCascadeInfo.java b/src/main/java/io/ebeaninternal/server/deploy/BeanCascadeInfo.java index af231db1d..36b7b2152 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/BeanCascadeInfo.java +++ b/src/main/java/io/ebeaninternal/server/deploy/BeanCascadeInfo.java @@ -36,8 +36,6 @@ public class BeanCascadeInfo { refresh = true; break; case PERSIST: - save = true; - break; case MERGE: save = true; break; diff --git a/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java b/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java index 73e061c52..a3981eb5d 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java +++ b/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java @@ -92,6 +92,7 @@ import io.ebeanservice.docstore.api.mapping.DocumentMapping; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.annotation.Nonnull; import javax.persistence.PersistenceException; import java.io.IOException; import java.io.StringWriter; @@ -1289,13 +1290,6 @@ public class BeanDescriptor implements BeanType, STreeType { return cacheHelp.getNaturalKey(); } - /** - * Return true if there is bean or query caching for this type. - */ - public boolean isCaching() { - return cacheHelp.isCaching(); - } - /** * Return true if there is currently bean caching for this type of bean. */ @@ -2117,13 +2111,6 @@ public class BeanDescriptor implements BeanType, STreeType { } } - /** - * Get a property value from a bean of this type. - */ - public Object getValue(EntityBean bean, String property) { - return getBeanProperty(property).getValue(bean); - } - /** * Return true if this bean type should use IdGeneration. *

@@ -2145,7 +2132,7 @@ public class BeanDescriptor implements BeanType, STreeType { /** * Return the class type this BeanDescriptor describes. */ - @Override + @Override @Nonnull public Class getBeanType() { return beanType; } @@ -2157,7 +2144,7 @@ public class BeanDescriptor implements BeanType, STreeType { * instead. *

*/ - @Override + @Override @Nonnull public String getFullName() { return fullName; } @@ -2165,7 +2152,7 @@ public class BeanDescriptor implements BeanType, STreeType { /** * Return the short name of the entity bean. */ - @Override + @Override @Nonnull public String getName() { return name; } @@ -2626,13 +2613,6 @@ public class BeanDescriptor implements BeanType, STreeType { } } - /** - * Return the name of the server this BeanDescriptor belongs to. - */ - public String getServerName() { - return serverName; - } - /** * Return true if this bean can cache sharable instances. *

@@ -3139,7 +3119,7 @@ public class BeanDescriptor implements BeanType, STreeType { return selectLastInsertedId != null; } - @Override + @Override @Nonnull public Collection allProperties() { return propertiesAll(); } @@ -3513,7 +3493,7 @@ public class BeanDescriptor implements BeanType, STreeType { jsonHelp.jsonWrite(writeJson, bean, key); } - void jsonWriteProperties(SpiJsonWriter writeJson, EntityBean bean) throws IOException { + void jsonWriteProperties(SpiJsonWriter writeJson, EntityBean bean) { jsonHelp.jsonWriteProperties(writeJson, bean); } diff --git a/src/main/java/io/ebeaninternal/server/deploy/BeanProperty.java b/src/main/java/io/ebeaninternal/server/deploy/BeanProperty.java index 0f22dee27..5fe365346 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/BeanProperty.java +++ b/src/main/java/io/ebeaninternal/server/deploy/BeanProperty.java @@ -1259,12 +1259,9 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty { public static boolean isLobType(int type) { switch (type) { case Types.CLOB: - return true; case Types.BLOB: - return true; - case Types.LONGVARBINARY: - return true; case Types.LONGVARCHAR: + case Types.LONGVARBINARY: return true; default: @@ -1312,13 +1309,6 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty { return excludedFromHistory; } - /** - * Return true if this is a ManyToMany with history support (on the intersection table). - */ - public boolean isManyToManyWithHistory() { - return false; - } - /** * Return true if this property hold unmapped JSON. */ diff --git a/src/main/java/io/ebeaninternal/server/deploy/BeanPropertyAssocMany.java b/src/main/java/io/ebeaninternal/server/deploy/BeanPropertyAssocMany.java index fd55ae6b2..0b9946830 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/BeanPropertyAssocMany.java +++ b/src/main/java/io/ebeaninternal/server/deploy/BeanPropertyAssocMany.java @@ -426,7 +426,7 @@ public class BeanPropertyAssocMany extends BeanPropertyAssoc implements ST } @Override - public Object read(DbReadContext ctx) throws SQLException { + public Object read(DbReadContext ctx) { return null; } @@ -957,10 +957,6 @@ public class BeanPropertyAssocMany extends BeanPropertyAssoc implements ST return targetDescriptor.isDocStoreMapped(); } - public BeanCollectionHelp getHelp() { - return help; - } - void jsonWriteMapEntry(SpiJsonWriter ctx, Map.Entry entry) throws IOException { elementDescriptor.jsonWriteMapEntry(ctx, entry); } diff --git a/src/main/java/io/ebeaninternal/server/deploy/DeployDocPropertyOptions.java b/src/main/java/io/ebeaninternal/server/deploy/DeployDocPropertyOptions.java index adb74e5ce..81d8ea3f8 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/DeployDocPropertyOptions.java +++ b/src/main/java/io/ebeaninternal/server/deploy/DeployDocPropertyOptions.java @@ -10,7 +10,7 @@ import io.ebeanservice.docstore.api.mapping.DocPropertyOptions; */ public class DeployDocPropertyOptions { - private static DocPropertyOptions EMPTY = new DocPropertyOptions(); + private static final DocPropertyOptions EMPTY = new DocPropertyOptions(); private DocPropertyOptions mapping; diff --git a/src/main/java/io/ebeaninternal/server/deploy/DeployUpdateParser.java b/src/main/java/io/ebeaninternal/server/deploy/DeployUpdateParser.java index 6669aeb9a..716820922 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/DeployUpdateParser.java +++ b/src/main/java/io/ebeaninternal/server/deploy/DeployUpdateParser.java @@ -54,7 +54,7 @@ public final class DeployUpdateParser extends DeployParser { } // append up to the dot - localBuffer.append(currentWord.substring(start, dotPos + 1)); + localBuffer.append(currentWord, start, dotPos + 1); if (dotPos == currentWord.length() - 1) { // ends with a "." ??? @@ -63,7 +63,7 @@ public final class DeployUpdateParser extends DeployParser { // get the remainder after the dot start = dotPos + 1; - String remainder = currentWord.substring(start, currentWord.length()); + String remainder = currentWord.substring(start); String dbWord = getDeployWord(remainder); if (dbWord != null) { diff --git a/src/main/java/io/ebeaninternal/server/deploy/DynamicPropertyAggregationFormula.java b/src/main/java/io/ebeaninternal/server/deploy/DynamicPropertyAggregationFormula.java index 5a584f15a..7651aae52 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/DynamicPropertyAggregationFormula.java +++ b/src/main/java/io/ebeaninternal/server/deploy/DynamicPropertyAggregationFormula.java @@ -5,7 +5,6 @@ import io.ebeaninternal.server.type.DataReader; import io.ebeaninternal.server.type.ScalarType; import javax.persistence.PersistenceException; -import java.sql.SQLException; /** * Dynamic property based on aggregation (max, min, avg, count). @@ -39,7 +38,7 @@ class DynamicPropertyAggregationFormula extends DynamicPropertyBase { } @Override - public Object read(DataReader dataReader) throws SQLException { + public Object read(DataReader dataReader) { try { return scalarType.read(dataReader); } catch (Exception e) { diff --git a/src/main/java/io/ebeaninternal/server/deploy/ExportedProperty.java b/src/main/java/io/ebeaninternal/server/deploy/ExportedProperty.java index 235e89713..8c4b789ab 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/ExportedProperty.java +++ b/src/main/java/io/ebeaninternal/server/deploy/ExportedProperty.java @@ -9,7 +9,7 @@ import io.ebeaninternal.server.core.InternString; * Used to for Assoc Manys to create references etc. *

*/ -public class ExportedProperty { +class ExportedProperty { private final String foreignDbColumn; @@ -17,7 +17,7 @@ public class ExportedProperty { private final boolean embedded; - public ExportedProperty(boolean embedded, String foreignDbColumn, BeanProperty property) { + ExportedProperty(boolean embedded, String foreignDbColumn, BeanProperty property) { this.embedded = embedded; this.foreignDbColumn = InternString.intern(foreignDbColumn); this.property = property; diff --git a/src/main/java/io/ebeaninternal/server/deploy/TableJoin.java b/src/main/java/io/ebeaninternal/server/deploy/TableJoin.java index 5d805aa20..a2b07648c 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/TableJoin.java +++ b/src/main/java/io/ebeaninternal/server/deploy/TableJoin.java @@ -141,14 +141,13 @@ public final class TableJoin { return type; } - public SqlJoinType addJoin(SqlJoinType joinType, String prefix, DbSqlContext ctx, String predicate) { + public void addJoin(SqlJoinType joinType, String prefix, DbSqlContext ctx, String predicate) { String[] names = SplitName.split(prefix); String a1 = ctx.getTableAlias(names[0]); String a2 = ctx.getTableAlias(prefix); - SqlJoinType returnJoinType = addJoin(joinType, a1, a2, ctx); + addJoin(joinType, a1, a2, ctx); ctx.append("and ").append(a2).append(predicate); - return returnJoinType; } public SqlJoinType addJoin(SqlJoinType joinType, String prefix, DbSqlContext ctx) { diff --git a/src/main/java/io/ebeaninternal/server/deploy/generatedproperty/InsertTimestampFactory.java b/src/main/java/io/ebeaninternal/server/deploy/generatedproperty/InsertTimestampFactory.java index 274834ab5..5c1cafd6b 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/generatedproperty/InsertTimestampFactory.java +++ b/src/main/java/io/ebeaninternal/server/deploy/generatedproperty/InsertTimestampFactory.java @@ -17,13 +17,12 @@ import java.util.Map; */ class InsertTimestampFactory { - private final GeneratedInsertLong longTime = new GeneratedInsertLong(); - private final Map, GeneratedProperty> map = new HashMap<>(); InsertTimestampFactory(ClassLoadConfig classLoadConfig) { map.put(Timestamp.class, new GeneratedInsertTimestamp()); map.put(java.util.Date.class, new GeneratedInsertDate()); + GeneratedInsertLong longTime = new GeneratedInsertLong(); map.put(Long.class, longTime); map.put(long.class, longTime); @@ -37,7 +36,6 @@ class InsertTimestampFactory { map.put(org.joda.time.LocalDateTime.class, new GeneratedInsertJodaTime.LocalDT()); map.put(org.joda.time.DateTime.class, new GeneratedInsertJodaTime.DateTimeDT()); } - } void setInsertTimestamp(DeployBeanProperty property) { diff --git a/src/main/java/io/ebeaninternal/server/deploy/generatedproperty/UpdateTimestampFactory.java b/src/main/java/io/ebeaninternal/server/deploy/generatedproperty/UpdateTimestampFactory.java index 4a812064c..5788569a7 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/generatedproperty/UpdateTimestampFactory.java +++ b/src/main/java/io/ebeaninternal/server/deploy/generatedproperty/UpdateTimestampFactory.java @@ -17,13 +17,12 @@ import java.util.Map; */ class UpdateTimestampFactory { - private final GeneratedUpdateLong longTime = new GeneratedUpdateLong(); - private final Map, GeneratedProperty> map = new HashMap<>(); UpdateTimestampFactory(ClassLoadConfig classLoadConfig) { map.put(Timestamp.class, new GeneratedUpdateTimestamp()); map.put(java.util.Date.class, new GeneratedUpdateDate()); + GeneratedUpdateLong longTime = new GeneratedUpdateLong(); map.put(Long.class, longTime); map.put(long.class, longTime); diff --git a/src/main/java/io/ebeaninternal/server/deploy/id/IdBinderEmpty.java b/src/main/java/io/ebeaninternal/server/deploy/id/IdBinderEmpty.java index 651c995d2..97c05670e 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/id/IdBinderEmpty.java +++ b/src/main/java/io/ebeaninternal/server/deploy/id/IdBinderEmpty.java @@ -127,7 +127,7 @@ public final class IdBinderEmpty implements IdBinder { } @Override - public void bindId(DataBind dataBind, Object value) throws SQLException { + public void bindId(DataBind dataBind, Object value) { } @@ -146,12 +146,12 @@ public final class IdBinderEmpty implements IdBinder { } @Override - public Object readSet(DbReadContext ctx, EntityBean bean) throws SQLException { + public Object readSet(DbReadContext ctx, EntityBean bean) { return null; } @Override - public Object read(DbReadContext ctx) throws SQLException { + public Object read(DbReadContext ctx) { return null; } @@ -170,12 +170,12 @@ public final class IdBinderEmpty implements IdBinder { } @Override - public Object readData(DataInput dataOutput) throws IOException { + public Object readData(DataInput dataOutput) { return null; } @Override - public void writeData(DataOutput dataOutput, Object idValue) throws IOException { + public void writeData(DataOutput dataOutput, Object idValue) { } diff --git a/src/main/java/io/ebeaninternal/server/deploy/id/ImportedIdSimple.java b/src/main/java/io/ebeaninternal/server/deploy/id/ImportedIdSimple.java index 5519ec523..14afc2feb 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/id/ImportedIdSimple.java +++ b/src/main/java/io/ebeaninternal/server/deploy/id/ImportedIdSimple.java @@ -41,8 +41,6 @@ public final class ImportedIdSimple implements ImportedId, Comparable owner, String localDbColumn, String localSqlFormula, BeanProperty foreignProperty, int position) { diff --git a/src/main/java/io/ebeaninternal/server/deploy/meta/DeployBeanProperty.java b/src/main/java/io/ebeaninternal/server/deploy/meta/DeployBeanProperty.java index f5b28dfa7..0d715f75e 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/meta/DeployBeanProperty.java +++ b/src/main/java/io/ebeaninternal/server/deploy/meta/DeployBeanProperty.java @@ -188,7 +188,7 @@ public class DeployBeanProperty { */ private int dbType; - private DeployDocPropertyOptions docMapping = new DeployDocPropertyOptions(); + private final DeployDocPropertyOptions docMapping = new DeployDocPropertyOptions(); /** * The method used to read the property. @@ -770,22 +770,14 @@ public class DeployBeanProperty { private boolean isNumericType(int type) { switch (type) { case Types.BIGINT: - return true; case Types.DECIMAL: - return true; - case Types.DOUBLE: - return true; - case Types.FLOAT: - return true; - case Types.INTEGER: - return true; - case Types.NUMERIC: - return true; - case Types.REAL: - return true; - case Types.SMALLINT: - return true; case Types.TINYINT: + case Types.SMALLINT: + case Types.REAL: + case Types.NUMERIC: + case Types.INTEGER: + case Types.FLOAT: + case Types.DOUBLE: return true; default: diff --git a/src/main/java/io/ebeaninternal/server/deploy/parse/DeployUtil.java b/src/main/java/io/ebeaninternal/server/deploy/parse/DeployUtil.java index 68ab4fb46..b8cafc39d 100644 --- a/src/main/java/io/ebeaninternal/server/deploy/parse/DeployUtil.java +++ b/src/main/java/io/ebeaninternal/server/deploy/parse/DeployUtil.java @@ -245,8 +245,6 @@ public class DeployUtil { private int getDbJsonStorage(DbJsonType dbJsonType) { switch (dbJsonType) { - case JSON: - return DbPlatformType.JSON; case JSONB: return DbPlatformType.JSONB; case VARCHAR: