diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/DefaultServer.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/DefaultServer.java index 8841349f4..d7b54ff69 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/core/DefaultServer.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/DefaultServer.java @@ -889,7 +889,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer { @Override public DtoQuery createNamedDtoQuery(Class dtoType, String namedQuery) { DtoBeanDescriptor descriptor = dtoBeanManager.descriptor(dtoType); - String sql = descriptor.getNamedRawSql(namedQuery); + String sql = descriptor.namedRawSql(namedQuery); if (sql == null) { throw new PersistenceException("No named query called " + namedQuery + " for bean:" + dtoType.getName()); } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/DtoQueryRequest.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/DtoQueryRequest.java index 5ca74e9f9..413074c49 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/core/DtoQueryRequest.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/DtoQueryRequest.java @@ -53,9 +53,9 @@ public final class DtoQueryRequest extends AbstractSqlQueryRequest { query.setCancelableQuery(ormQuery); // execute the underlying ORM query returning the ResultSet SpiResultSet result = server.findResultSet(ormQuery, transaction); - this.pstmt = result.getStatement(); + this.pstmt = result.statement(); this.sql = ormQuery.getGeneratedSql(); - setResultSet(result.getResultSet(), ormQuery.queryPlanKey()); + setResultSet(result.resultSet(), ormQuery.queryPlanKey()); } else { // native SQL query execution diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/MultiTenantDbCatalogSupplier.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/MultiTenantDbCatalogSupplier.java index 386d4c383..9ab4b86a5 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/core/MultiTenantDbCatalogSupplier.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/MultiTenantDbCatalogSupplier.java @@ -41,22 +41,22 @@ final class MultiTenantDbCatalogSupplier implements DataSourceSupplier { } @Override - public DataSource getDataSource() { + public DataSource dataSource() { return catalogDataSource; } @Override - public DataSource getReadOnlyDataSource() { + public DataSource readOnlyDataSource() { return readOnly; } @Override - public Connection getConnection(Object tenantId) throws SQLException { + public Connection connection(Object tenantId) throws SQLException { return catalogDataSource.getConnectionForTenant(tenantId); } @Override - public Connection getReadOnlyConnection(Object tenantId) throws SQLException { + public Connection readOnlyConnection(Object tenantId) throws SQLException { return readOnly.getConnectionForTenant(tenantId); } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/MultiTenantDbSchemaSupplier.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/MultiTenantDbSchemaSupplier.java index eca06a893..806a90d05 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/core/MultiTenantDbSchemaSupplier.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/MultiTenantDbSchemaSupplier.java @@ -41,22 +41,22 @@ final class MultiTenantDbSchemaSupplier implements DataSourceSupplier { } @Override - public DataSource getDataSource() { + public DataSource dataSource() { return schemaDataSource; } @Override - public DataSource getReadOnlyDataSource() { + public DataSource readOnlyDataSource() { return readOnly; } @Override - public Connection getConnection(Object tenantId) throws SQLException { + public Connection connection(Object tenantId) throws SQLException { return schemaDataSource.getConnectionForTenant(tenantId); } @Override - public Connection getReadOnlyConnection(Object tenantId) throws SQLException { + public Connection readOnlyConnection(Object tenantId) throws SQLException { return readOnly.getConnectionForTenant(tenantId); } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/MultiTenantDbSupplier.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/MultiTenantDbSupplier.java index c0e810eff..5eeefded3 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/core/MultiTenantDbSupplier.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/MultiTenantDbSupplier.java @@ -27,23 +27,23 @@ final class MultiTenantDbSupplier implements DataSourceSupplier { } @Override - public DataSource getReadOnlyDataSource() { + public DataSource readOnlyDataSource() { // read only datasource not supported with DB per tenant at this stage return null; } @Override - public DataSource getDataSource() { + public DataSource dataSource() { return dataSourceProvider.dataSource(tenantProvider.currentId()); } @Override - public Connection getConnection(Object tenantId) throws SQLException { + public Connection connection(Object tenantId) throws SQLException { return dataSourceProvider.dataSource(tenantId).getConnection(); } @Override - public Connection getReadOnlyConnection(Object tenantId) throws SQLException { + public Connection readOnlyConnection(Object tenantId) throws SQLException { throw new SQLException("Not currently supported"); } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/PersistRequestBean.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/PersistRequestBean.java index f4a41c25d..32da95dab 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/core/PersistRequestBean.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/PersistRequestBean.java @@ -547,7 +547,7 @@ public final class PersistRequestBean extends PersistRequest implements BeanP *

* Takes into account the class type and id value. */ - private Integer getBeanHash() { + private Integer beanHash() { if (beanHash == null) { Object id = beanDescriptor.getId(entityBean); int hc = 92821 * bean.getClass().getName().hashCode(); @@ -560,7 +560,7 @@ public final class PersistRequestBean extends PersistRequest implements BeanP } public void registerDeleteBean() { - Integer hash = getBeanHash(); + Integer hash = beanHash(); transaction.registerDeleteBean(hash); } @@ -568,7 +568,7 @@ public final class PersistRequestBean extends PersistRequest implements BeanP if (transaction == null) { return false; } else { - Integer hash = getBeanHash(); + Integer hash = beanHash(); return transaction.isRegisteredDeleteBean(hash); } } @@ -712,7 +712,7 @@ public final class PersistRequestBean extends PersistRequest implements BeanP /** * Return the original / old value for the given property. */ - public Object getOrigValue(BeanProperty prop) { + public Object origValue(BeanProperty prop) { return intercept.origValue(prop.propertyIndex()); } @@ -1360,7 +1360,7 @@ public final class PersistRequestBean extends PersistRequest implements BeanP * Set an orphan bean that needs to be deleted AFTER the request has persisted. */ public void setImportedOrphanForRemoval(BeanPropertyAssocOne prop) { - Object orphan = getOrigValue(prop); + Object orphan = origValue(prop); if (orphan instanceof EntityBean) { orphanBean = (EntityBean) orphan; } @@ -1373,7 +1373,7 @@ public final class PersistRequestBean extends PersistRequest implements BeanP /** * Return the SQL used to fetch the last inserted id value. */ - public String getSelectLastInsertedId() { + public String selectLastInsertedId() { return beanDescriptor.selectLastInsertedId(publish); } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/RelationalQueryRequest.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/RelationalQueryRequest.java index 8b5002b45..b2e33e57e 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/core/RelationalQueryRequest.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/RelationalQueryRequest.java @@ -30,7 +30,7 @@ public final class RelationalQueryRequest extends AbstractSqlQueryRequest { @Override protected void setResultSet(ResultSet resultSet, Object planKey) throws SQLException { this.resultSet = resultSet; - this.propertyNames = getPropertyNames(); + this.propertyNames = propertyNames(); // calculate the initialCapacity of the Map to reduce rehashing float initCap = (propertyNames.length) / 0.7f; this.estimateCapacity = (int) initCap + 1; @@ -95,7 +95,7 @@ public final class RelationalQueryRequest extends AbstractSqlQueryRequest { /** * Build the list of property names. */ - private String[] getPropertyNames() throws SQLException { + private String[] propertyNames() throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); int columnsPlusOne = metaData.getColumnCount() + 1; ArrayList propNames = new ArrayList<>(columnsPlusOne - 1); @@ -127,7 +127,7 @@ public final class RelationalQueryRequest extends AbstractSqlQueryRequest { } } - public ResultSet getResultSet() { + public ResultSet resultSet() { return resultSet; } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/SimpleDataSourceProvider.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/SimpleDataSourceProvider.java index 03640dc90..0d544045e 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/core/SimpleDataSourceProvider.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/SimpleDataSourceProvider.java @@ -26,22 +26,22 @@ final class SimpleDataSourceProvider implements DataSourceSupplier { } @Override - public DataSource getDataSource() { + public DataSource dataSource() { return dataSource; } @Override - public DataSource getReadOnlyDataSource() { + public DataSource readOnlyDataSource() { return readOnlyDataSource; } @Override - public Connection getConnection(Object tenantId) throws SQLException { + public Connection connection(Object tenantId) throws SQLException { return dataSource.getConnection(); } @Override - public Connection getReadOnlyConnection(Object tenantId) throws SQLException { + public Connection readOnlyConnection(Object tenantId) throws SQLException { return readOnlyDataSource.getConnection(); } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/SpiResultSet.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/SpiResultSet.java index ed114375b..6f9c21077 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/core/SpiResultSet.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/SpiResultSet.java @@ -19,11 +19,11 @@ public final class SpiResultSet { this.resultSet = resultSet; } - public PreparedStatement getStatement() { + public PreparedStatement statement() { return statement; } - public ResultSet getResultSet() { + public ResultSet resultSet() { return resultSet; } } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java index c34a79a70..73bb1c126 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java @@ -2355,7 +2355,7 @@ public class BeanDescriptor implements BeanType, STreeType, SpiBeanType { ElPropertyDeploy fk = elDeployCache.get(propName); if (fk instanceof BeanFkeyProperty) { // propertyDeploy chain for foreign key column - return ((BeanFkeyProperty) fk).create(chain.getExpression(), chain.isContainsMany()); + return ((BeanFkeyProperty) fk).create(chain.expression(), chain.isContainsMany()); } } int basePos = propName.indexOf('.'); @@ -2375,7 +2375,7 @@ public class BeanDescriptor implements BeanType, STreeType, SpiBeanType { return property; } if (property == null) { - throw new PersistenceException("No property found for [" + propName + "] in expression " + chain.getExpression()); + throw new PersistenceException("No property found for [" + propName + "] in expression " + chain.expression()); } if (property.containsMany()) { chain.setContainsMany(); diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/dto/DtoBeanDescriptor.java b/ebean-core/src/main/java/io/ebeaninternal/server/dto/DtoBeanDescriptor.java index a56a00186..c9720308a 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/dto/DtoBeanDescriptor.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/dto/DtoBeanDescriptor.java @@ -46,7 +46,7 @@ public final class DtoBeanDescriptor { /** * Return the named RawSql query. */ - public String getNamedRawSql(String name) { + public String namedRawSql(String name) { return namedQueries.get(name); } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/el/ElComparatorCompound.java b/ebean-core/src/main/java/io/ebeaninternal/server/el/ElComparatorCompound.java index dc4dd6eeb..bf94c534d 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/el/ElComparatorCompound.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/el/ElComparatorCompound.java @@ -20,7 +20,6 @@ public final class ElComparatorCompound implements Comparator, ElComparato @Override public int compare(T o1, T o2) { - for (ElComparator anArray : array) { int ret = anArray.compare(o1, o2); if (ret != 0) { @@ -33,14 +32,12 @@ public final class ElComparatorCompound implements Comparator, ElComparato @Override public int compareValue(Object value, T o2) { - for (ElComparator anArray : array) { int ret = anArray.compareValue(value, o2); if (ret != 0) { return ret; } } - return 0; } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/el/ElComparatorProperty.java b/ebean-core/src/main/java/io/ebeaninternal/server/el/ElComparatorProperty.java index bddcf5310..253737ed9 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/el/ElComparatorProperty.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/el/ElComparatorProperty.java @@ -23,7 +23,6 @@ public final class ElComparatorProperty implements Comparator, ElComparato @Override public int compare(T o1, T o2) { - Object val1 = elGetValue.pathGet(o1); Object val2 = elGetValue.pathGet(o2); return compareValues(val1, val2); @@ -31,14 +30,12 @@ public final class ElComparatorProperty implements Comparator, ElComparato @Override public int compareValue(Object value, T o2) { - Object val2 = elGetValue.pathGet(o2); return compareValues(value, val2); } @SuppressWarnings({"unchecked", "rawtypes"}) public int compareValues(Object val1, Object val2) { - if (val1 == null) { return val2 == null ? 0 : nullOrder; } @@ -55,5 +52,4 @@ public final class ElComparatorProperty implements Comparator, ElComparato return asc * c.compareTo(val2); } - } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/el/ElFilter.java b/ebean-core/src/main/java/io/ebeaninternal/server/el/ElFilter.java index 105dff381..e658f841a 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/el/ElFilter.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/el/ElFilter.java @@ -30,13 +30,11 @@ public final class ElFilter implements Filter { return elGetValue.convert(value); } - private ElComparator getElComparator(String propertyName) { - + private ElComparator elComparator(String propertyName) { return beanDescriptor.elComparator(propertyName); } - private ElPropertyValue getElGetValue(String propertyName) { - + private ElPropertyValue elGetValue(String propertyName) { return beanDescriptor.elGetValue(propertyName); } @@ -55,119 +53,80 @@ public final class ElFilter implements Filter { return true; } - @Override public Filter in(String propertyName, Set matchingValues) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); - - matches.add(new ElMatchBuilder.InSet<>(matchingValues, elGetValue)); + matches.add(new ElMatchBuilder.InSet<>(matchingValues, elGetValue(propertyName))); return this; } @Override public Filter eq(String propertyName, Object value) { - value = convertValue(propertyName, value); - ElComparator comparator = getElComparator(propertyName); - - matches.add(new ElMatchBuilder.Eq<>(value, comparator)); + matches.add(new ElMatchBuilder.Eq<>(value, elComparator(propertyName))); return this; } - @Override public Filter ne(String propertyName, Object value) { - value = convertValue(propertyName, value); - ElComparator comparator = getElComparator(propertyName); - - matches.add(new ElMatchBuilder.Ne<>(value, comparator)); + matches.add(new ElMatchBuilder.Ne<>(value, elComparator(propertyName))); return this; } @Override public Filter between(String propertyName, Object min, Object max) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); + ElPropertyValue elGetValue = elGetValue(propertyName); min = elGetValue.convert(min); max = elGetValue.convert(max); - ElComparator elComparator = getElComparator(propertyName); - - matches.add(new ElMatchBuilder.Between<>(min, max, elComparator)); + matches.add(new ElMatchBuilder.Between<>(min, max, elComparator(propertyName))); return this; } @Override public Filter gt(String propertyName, Object value) { - value = convertValue(propertyName, value); - ElComparator comparator = getElComparator(propertyName); - - matches.add(new ElMatchBuilder.Gt<>(value, comparator)); + matches.add(new ElMatchBuilder.Gt<>(value, elComparator(propertyName))); return this; } @Override public Filter ge(String propertyName, Object value) { - value = convertValue(propertyName, value); - ElComparator comparator = getElComparator(propertyName); - - matches.add(new ElMatchBuilder.Ge<>(value, comparator)); + matches.add(new ElMatchBuilder.Ge<>(value, elComparator(propertyName))); return this; } @Override public Filter ieq(String propertyName, String value) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); - - matches.add(new ElMatchBuilder.Ieq<>(elGetValue, value)); + matches.add(new ElMatchBuilder.Ieq<>(elGetValue(propertyName), value)); return this; } - @Override public Filter isNotNull(String propertyName) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); - - matches.add(new ElMatchBuilder.IsNotNull<>(elGetValue)); + matches.add(new ElMatchBuilder.IsNotNull<>(elGetValue(propertyName))); return this; } - @Override public Filter isNull(String propertyName) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); - - matches.add(new ElMatchBuilder.IsNull<>(elGetValue)); + matches.add(new ElMatchBuilder.IsNull<>(elGetValue(propertyName))); return this; } - @Override public Filter le(String propertyName, Object value) { - value = convertValue(propertyName, value); - ElComparator comparator = getElComparator(propertyName); - - matches.add(new ElMatchBuilder.Le<>(value, comparator)); + matches.add(new ElMatchBuilder.Le<>(value, elComparator(propertyName))); return this; } - @Override public Filter lt(String propertyName, Object value) { - value = convertValue(propertyName, value); - ElComparator comparator = getElComparator(propertyName); - - matches.add(new ElMatchBuilder.Lt<>(value, comparator)); + matches.add(new ElMatchBuilder.Lt<>(value, elComparator(propertyName))); return this; } @@ -176,63 +135,45 @@ public final class ElFilter implements Filter { } public Filter regex(String propertyName, String regEx, int options) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); - - matches.add(new ElMatchBuilder.RegularExpr<>(elGetValue, regEx, options)); + matches.add(new ElMatchBuilder.RegularExpr<>(elGetValue(propertyName), regEx, options)); return this; } @Override public Filter contains(String propertyName, String value) { - String quote = ".*" + Pattern.quote(value) + ".*"; - - ElPropertyValue elGetValue = getElGetValue(propertyName); - matches.add(new ElMatchBuilder.RegularExpr<>(elGetValue, quote, 0)); + matches.add(new ElMatchBuilder.RegularExpr<>(elGetValue(propertyName), quote, 0)); return this; } @Override public Filter icontains(String propertyName, String value) { - String quote = ".*" + Pattern.quote(value) + ".*"; - - ElPropertyValue elGetValue = getElGetValue(propertyName); - matches.add(new ElMatchBuilder.RegularExpr<>(elGetValue, quote, Pattern.CASE_INSENSITIVE)); + matches.add(new ElMatchBuilder.RegularExpr<>(elGetValue(propertyName), quote, Pattern.CASE_INSENSITIVE)); return this; } - @Override public Filter endsWith(String propertyName, String value) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); - matches.add(new ElMatchBuilder.EndsWith<>(elGetValue, value)); + matches.add(new ElMatchBuilder.EndsWith<>(elGetValue(propertyName), value)); return this; } @Override public Filter startsWith(String propertyName, String value) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); - matches.add(new ElMatchBuilder.StartsWith<>(elGetValue, value)); + matches.add(new ElMatchBuilder.StartsWith<>(elGetValue(propertyName), value)); return this; } @Override public Filter iendsWith(String propertyName, String value) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); - matches.add(new ElMatchBuilder.IEndsWith<>(elGetValue, value)); + matches.add(new ElMatchBuilder.IEndsWith<>(elGetValue(propertyName), value)); return this; } @Override public Filter istartsWith(String propertyName, String value) { - - ElPropertyValue elGetValue = getElGetValue(propertyName); - matches.add(new ElMatchBuilder.IStartsWith<>(elGetValue, value)); + matches.add(new ElMatchBuilder.IStartsWith<>(elGetValue(propertyName), value)); return this; } @@ -244,7 +185,6 @@ public final class ElFilter implements Filter { @Override public List filter(List list) { - if (sortByClause != null) { // create shallow copy and sort list = new ArrayList<>(list); @@ -252,7 +192,6 @@ public final class ElFilter implements Filter { } ArrayList filterList = new ArrayList<>(); - for (T t : list) { if (isMatch(t)) { filterList.add(t); @@ -261,7 +200,6 @@ public final class ElFilter implements Filter { } } } - return filterList; } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/el/ElMatchBuilder.java b/ebean-core/src/main/java/io/ebeaninternal/server/el/ElMatchBuilder.java index 66e966cfb..ea371a7b5 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/el/ElMatchBuilder.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/el/ElMatchBuilder.java @@ -76,7 +76,6 @@ final class ElMatchBuilder { @Override public boolean isMatch(T bean) { - String v = (String) elGetValue.pathGet(bean); return charMatch.startsWith(v); } @@ -97,7 +96,6 @@ final class ElMatchBuilder { @Override public boolean isMatch(T bean) { - String v = (String) elGetValue.pathGet(bean); return charMatch.endsWith(v); } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/el/ElPropertyChain.java b/ebean-core/src/main/java/io/ebeaninternal/server/el/ElPropertyChain.java index b04bacb24..12d376bed 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/el/ElPropertyChain.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/el/ElPropertyChain.java @@ -67,8 +67,8 @@ public final class ElPropertyChain implements ElPropertyValue { this.scalarType = null; } this.lastElPropertyValue = chain[chain.length - 1]; - this.placeHolder = getElPlaceHolder(prefix, lastElPropertyValue, false); - this.placeHolderEncrypted = getElPlaceHolder(prefix, lastElPropertyValue, true); + this.placeHolder = placeHolder(prefix, lastElPropertyValue, false); + this.placeHolderEncrypted = placeHolder(prefix, lastElPropertyValue, true); } @Override @@ -86,7 +86,7 @@ public final class ElPropertyChain implements ElPropertyValue { return false; } - private String getElPlaceHolder(String prefix, ElPropertyValue lastElPropertyValue, boolean encrypted) { + private String placeHolder(String prefix, ElPropertyValue lastElPropertyValue, boolean encrypted) { if (prefix == null) { return lastElPropertyValue.elPlaceholder(encrypted); } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/el/ElPropertyChainBuilder.java b/ebean-core/src/main/java/io/ebeaninternal/server/el/ElPropertyChainBuilder.java index fd69bdd9c..409f17bc7 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/el/ElPropertyChainBuilder.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/el/ElPropertyChainBuilder.java @@ -36,7 +36,7 @@ public final class ElPropertyChainBuilder { this.containsMany = true; } - public String getExpression() { + public String expression() { return expression; } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/expression/DefaultExampleExpression.java b/ebean-core/src/main/java/io/ebeaninternal/server/expression/DefaultExampleExpression.java index 708792852..83c305224 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/expression/DefaultExampleExpression.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/expression/DefaultExampleExpression.java @@ -206,7 +206,6 @@ final class DefaultExampleExpression implements SpiExpression, ExampleExpression */ @Override public void addSql(SpiExpressionRequest request) { - if (list.isEmpty()) { request.append(SQL_TRUE); } else { @@ -270,7 +269,6 @@ final class DefaultExampleExpression implements SpiExpression, ExampleExpression * Add expressions to the list for all the non-null properties (and do this recursively). */ private void addExpressions(ArrayList list, BeanDescriptor beanDescriptor, EntityBean bean, String prefix) { - for (BeanProperty beanProperty : beanDescriptor.propertiesAll()) { if (!beanProperty.isTransient()) { diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/persist/DefaultPersister.java b/ebean-core/src/main/java/io/ebeaninternal/server/persist/DefaultPersister.java index 3d54c0167..7f1dcc1fc 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/persist/DefaultPersister.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/persist/DefaultPersister.java @@ -1077,7 +1077,7 @@ public final class DefaultPersister implements Persister { } private void deleteOrphan(PersistRequestBean request, BeanPropertyAssocOne prop) { - Object origValue = request.getOrigValue(prop); + Object origValue = request.origValue(prop); if (origValue instanceof EntityBean) { delete((EntityBean) origValue, request.transaction(), false); } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/persist/dml/InsertHandler.java b/ebean-core/src/main/java/io/ebeaninternal/server/persist/dml/InsertHandler.java index 399cae8d1..9859901bb 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/persist/dml/InsertHandler.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/persist/dml/InsertHandler.java @@ -148,7 +148,7 @@ public final class InsertHandler extends DmlHandler { PreparedStatement stmt = null; ResultSet rset = null; try { - stmt = transaction.connection().prepareStatement(persistRequest.getSelectLastInsertedId()); + stmt = transaction.connection().prepareStatement(persistRequest.selectLastInsertedId()); rset = stmt.executeQuery(); setGeneratedKey(rset); } finally { diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultRelationalQueryEngine.java b/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultRelationalQueryEngine.java index 047b9f696..3ffb1ae6b 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultRelationalQueryEngine.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/query/DefaultRelationalQueryEngine.java @@ -130,7 +130,7 @@ public final class DefaultRelationalQueryEngine implements RelationalQueryEngine ScalarType scalarType = (ScalarType) binder.getScalarType(cls); try { request.executeSql(binder, SpiQuery.Type.ATTRIBUTE); - final DataReader dataReader = binder.createDataReader(request.getResultSet()); + final DataReader dataReader = binder.createDataReader(request.resultSet()); T value = null; if (dataReader.next()) { value = scalarType.read(dataReader); @@ -152,7 +152,7 @@ public final class DefaultRelationalQueryEngine implements RelationalQueryEngine ScalarType scalarType = (ScalarType) binder.getScalarType(cls); try { request.executeSql(binder, SpiQuery.Type.ATTRIBUTE); - final DataReader dataReader = binder.createDataReader(request.getResultSet()); + final DataReader dataReader = binder.createDataReader(request.resultSet()); List rows = new ArrayList<>(); while (dataReader.next()) { rows.add(scalarType.read(dataReader)); @@ -174,7 +174,7 @@ public final class DefaultRelationalQueryEngine implements RelationalQueryEngine ScalarType scalarType = (ScalarType) binder.getScalarType(cls); try { request.executeSql(binder, SpiQuery.Type.ATTRIBUTE); - final DataReader dataReader = binder.createDataReader(request.getResultSet()); + final DataReader dataReader = binder.createDataReader(request.resultSet()); while (dataReader.next()) { consumer.accept(scalarType.read(dataReader)); } diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/DataSourceSupplier.java b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/DataSourceSupplier.java index da100b546..cc9c88f53 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/DataSourceSupplier.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/DataSourceSupplier.java @@ -17,7 +17,7 @@ public interface DataSourceSupplier { *

* This should take into account multi-tenancy and the current tenantId. */ - DataSource getDataSource(); + DataSource dataSource(); /** * Return the read only DataSource to use for the current request. @@ -25,7 +25,7 @@ public interface DataSourceSupplier { * This can return null meaning that no read only DataSource (with autoCommit) * is available for use so normal transactions with explicit commit should be used. */ - DataSource getReadOnlyDataSource(); + DataSource readOnlyDataSource(); /** * Obtain the current TenantId *IF* it is required for the DataSource. @@ -38,7 +38,7 @@ public interface DataSourceSupplier { * @param tenantId Most often null but well supplied indicates a multi-tenant lazy loading query * @return the connection to use */ - Connection getConnection(Object tenantId) throws SQLException; + Connection connection(Object tenantId) throws SQLException; /** * Return a connection from the read only DataSource taking into account a tenantId for multi-tenant lazy loading. @@ -46,7 +46,7 @@ public interface DataSourceSupplier { * @param tenantId Most often null but well supplied indicates a multi-tenant lazy loading query * @return the connection to use */ - Connection getReadOnlyConnection(Object tenantId) throws SQLException; + Connection readOnlyConnection(Object tenantId) throws SQLException; /** * Shutdown the datasource de-registering the JDBC driver if requested. diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryBasic.java b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryBasic.java index a190cf64e..181646cf8 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryBasic.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryBasic.java @@ -17,7 +17,7 @@ class TransactionFactoryBasic extends TransactionFactory { TransactionFactoryBasic(TransactionManager manager, DataSourceSupplier dataSourceSupplier) { super(manager); - this.dataSource = dataSourceSupplier.getDataSource(); + this.dataSource = dataSourceSupplier.dataSource(); } @Override diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryBasicWithRead.java b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryBasicWithRead.java index d84361480..c0ca58dd0 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryBasicWithRead.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryBasicWithRead.java @@ -22,7 +22,7 @@ final class TransactionFactoryBasicWithRead extends TransactionFactoryBasic { TransactionFactoryBasicWithRead(TransactionManager manager, DataSourceSupplier dataSourceSupplier) { super(manager, dataSourceSupplier); - this.readOnlyDataSource = dataSourceSupplier.getReadOnlyDataSource(); + this.readOnlyDataSource = dataSourceSupplier.readOnlyDataSource(); } @Override diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryBuilder.java b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryBuilder.java index b2b7e875f..24c76c29c 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryBuilder.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryBuilder.java @@ -12,7 +12,7 @@ final class TransactionFactoryBuilder { */ static TransactionFactory build(TransactionManager manager, DataSourceSupplier dataSourceSupplier, CurrentTenantProvider tenantProvider) { - boolean hasReadOnlyDataSource = dataSourceSupplier.getReadOnlyDataSource() != null; + boolean hasReadOnlyDataSource = dataSourceSupplier.readOnlyDataSource() != null; if (tenantProvider == null) { if (hasReadOnlyDataSource) { return new TransactionFactoryBasicWithRead(manager, dataSourceSupplier); diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryTenant.java b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryTenant.java index 64c9c9511..c29a12b42 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryTenant.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryTenant.java @@ -41,7 +41,7 @@ class TransactionFactoryTenant extends TransactionFactory { // tenantId not set (by lazy loading) so get current tenantId tenantId = tenantProvider.currentId(); } - connection = dataSourceSupplier.getConnection(tenantId); + connection = dataSourceSupplier.connection(tenantId); SpiTransaction transaction = manager.createTransaction(explicit, connection); transaction.setTenantId(tenantId); return transaction; diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryTenantWithRead.java b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryTenantWithRead.java index d4feba7b5..7c63f685a 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryTenantWithRead.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionFactoryTenantWithRead.java @@ -30,7 +30,7 @@ final class TransactionFactoryTenantWithRead extends TransactionFactoryTenant { // obtain the tenantId if the DataSource requires it tenantId = dataSourceSupplier.currentTenantId(); } - connection = dataSourceSupplier.getReadOnlyConnection(tenantId); + connection = dataSourceSupplier.readOnlyConnection(tenantId); return new ImplicitReadOnlyTransaction(manager, connection, tenantId); } catch (PersistenceException ex) { JdbcClose.close(connection); diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionManager.java b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionManager.java index bfaf8cfb5..7d4293af5 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionManager.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionManager.java @@ -248,17 +248,17 @@ public class TransactionManager implements SpiTransactionManager { @Override public final Connection queryPlanConnection() throws SQLException { - return dataSourceSupplier.getConnection(null); + return dataSourceSupplier.connection(null); } @Override public final DataSource dataSource() { - return dataSourceSupplier.getDataSource(); + return dataSourceSupplier.dataSource(); } @Override public final DataSource readOnlyDataSource() { - return dataSourceSupplier.getReadOnlyDataSource(); + return dataSourceSupplier.readOnlyDataSource(); } /**