mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
No effective change - Code cleanup, convert unnecessary fields to local vars
This commit is contained in:
@@ -11,8 +11,6 @@ public class ClassUtil {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ClassUtil.class);
|
||||
|
||||
private static boolean preferContext = true;
|
||||
|
||||
/**
|
||||
* Load a class taking into account a context class loader (if present).
|
||||
*/
|
||||
@@ -28,7 +26,7 @@ public class ClassUtil {
|
||||
if (caller == null) {
|
||||
caller = ClassUtil.class;
|
||||
}
|
||||
ClassLoadContext ctx = ClassLoadContext.of(caller, preferContext);
|
||||
ClassLoadContext ctx = ClassLoadContext.of(caller, true);
|
||||
|
||||
return ctx.forName(name);
|
||||
}
|
||||
|
||||
@@ -36,8 +36,6 @@ public class DdlGenerator implements SpiEbeanPlugin {
|
||||
|
||||
private DatabasePlatform dbPlatform;
|
||||
|
||||
private int summaryLength = 80;
|
||||
|
||||
private boolean generateDdl;
|
||||
private boolean runDdl;
|
||||
|
||||
@@ -340,8 +338,8 @@ public class DdlGenerator implements SpiEbeanPlugin {
|
||||
}
|
||||
|
||||
private String getSummary(String s) {
|
||||
if (s.length() > summaryLength) {
|
||||
return s.substring(0, summaryLength).trim() + "...";
|
||||
if (s.length() > 80) {
|
||||
return s.substring(0, 80).trim() + "...";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -254,11 +254,6 @@ public class BeanDescriptor<T> implements MetaBeanInfo {
|
||||
*/
|
||||
private boolean deleteRecurseSkippable;
|
||||
|
||||
/**
|
||||
* Make the TypeManager available for helping SqlSelect.
|
||||
*/
|
||||
private final TypeManager typeManager;
|
||||
|
||||
private final EntityBean prototypeEntityBean;
|
||||
|
||||
private final IdBinder idBinder;
|
||||
@@ -307,7 +302,6 @@ public class BeanDescriptor<T> implements MetaBeanInfo {
|
||||
this.fullName = InternString.intern(deploy.getFullName());
|
||||
this.descriptorId = descriptorId;
|
||||
|
||||
this.typeManager = typeManager;
|
||||
this.beanType = deploy.getBeanType();
|
||||
this.prototypeEntityBean = createPrototypeEntityBean(beanType);
|
||||
|
||||
|
||||
@@ -33,8 +33,6 @@ public class DRawSqlSelectBuilder {
|
||||
|
||||
private final SimpleTextParser textParser;
|
||||
|
||||
private List<DRawSqlColumnInfo> selectColumns;
|
||||
|
||||
private int placeHolderWhere;
|
||||
private int placeHolderAndWhere;
|
||||
private int placeHolderHaving;
|
||||
@@ -100,7 +98,7 @@ public class DRawSqlSelectBuilder {
|
||||
parseSqlFindKeywords(true);
|
||||
}
|
||||
|
||||
selectColumns = findSelectColumns(meta.getColumnMapping());
|
||||
List<DRawSqlColumnInfo> selectColumns = findSelectColumns(meta.getColumnMapping());
|
||||
whereExprPos = findWhereExprPosition();
|
||||
havingExprPos = findHavingExprPosition();
|
||||
|
||||
|
||||
@@ -24,11 +24,6 @@ public final class DefaultPersistExecute implements PersistExecute {
|
||||
*/
|
||||
private final int defaultBatchSize;
|
||||
|
||||
/**
|
||||
* Default for whether to call getGeneratedKeys after batch insert.
|
||||
*/
|
||||
private final boolean defaultBatchGenKeys = true;
|
||||
|
||||
/**
|
||||
* Construct this DmlPersistExecute.
|
||||
*/
|
||||
@@ -43,7 +38,7 @@ public final class DefaultPersistExecute implements PersistExecute {
|
||||
public BatchControl createBatchControl(SpiTransaction t) {
|
||||
|
||||
// create a BatchControl and set its defaults
|
||||
return new BatchControl(t, defaultBatchSize, defaultBatchGenKeys);
|
||||
return new BatchControl(t, defaultBatchSize, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,14 +22,14 @@ public class ExeUpdateSql {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ExeUpdateSql.class);
|
||||
|
||||
private static final int defaultBatchSize = 20;
|
||||
|
||||
private final Binder binder;
|
||||
|
||||
private final PstmtFactory pstmtFactory;
|
||||
|
||||
private final PstmtBatch pstmtBatch;
|
||||
|
||||
private int defaultBatchSize = 20;
|
||||
|
||||
/**
|
||||
* Create with a given binder.
|
||||
*/
|
||||
|
||||
@@ -21,10 +21,6 @@ import com.avaje.ebeaninternal.server.persist.dmlbind.BindableList;
|
||||
*/
|
||||
public final class UpdateMeta {
|
||||
|
||||
private final String sqlVersion;
|
||||
|
||||
private final String sqlNone;
|
||||
|
||||
private final BindableList set;
|
||||
private final BindableId id;
|
||||
private final Bindable version;
|
||||
@@ -43,8 +39,8 @@ public final class UpdateMeta {
|
||||
this.id = id;
|
||||
this.version = version;
|
||||
|
||||
this.sqlNone = genSql(ConcurrencyMode.NONE, null, set);
|
||||
this.sqlVersion = genSql(ConcurrencyMode.VERSION, null, set);
|
||||
String sqlNone = genSql(ConcurrencyMode.NONE, null, set);
|
||||
String sqlVersion = genSql(ConcurrencyMode.VERSION, null, set);
|
||||
|
||||
this.modeNoneUpdatePlan = new UpdatePlan(ConcurrencyMode.NONE, sqlNone, set);
|
||||
this.modeVersionUpdatePlan = new UpdatePlan(ConcurrencyMode.VERSION, sqlVersion, set);
|
||||
|
||||
@@ -115,11 +115,6 @@ public class CQueryPredicates {
|
||||
*/
|
||||
private String dbFilterMany;
|
||||
|
||||
/**
|
||||
* The order by clause.
|
||||
*/
|
||||
private String logicalOrderBy;
|
||||
|
||||
private String dbOrderBy;
|
||||
|
||||
/**
|
||||
@@ -336,7 +331,7 @@ public class CQueryPredicates {
|
||||
private void parsePropertiesToDbColumns(DeployParser deployParser) {
|
||||
|
||||
// order by is dependent on the manyProperty (if there is one)
|
||||
logicalOrderBy = deriveOrderByWithMany(request.getManyProperty());
|
||||
String logicalOrderBy = deriveOrderByWithMany(request.getManyProperty());
|
||||
if (logicalOrderBy != null) {
|
||||
dbOrderBy = deployParser.parse(logicalOrderBy);
|
||||
}
|
||||
|
||||
@@ -54,8 +54,6 @@ public class CQueryRowCount {
|
||||
|
||||
private String bindLog;
|
||||
|
||||
private long startNano;
|
||||
|
||||
private int executionTimeMicros;
|
||||
|
||||
private int rowCount;
|
||||
@@ -112,7 +110,7 @@ public class CQueryRowCount {
|
||||
*/
|
||||
public int findRowCount() throws SQLException {
|
||||
|
||||
startNano = System.nanoTime();
|
||||
long startNano = System.nanoTime();
|
||||
try {
|
||||
|
||||
SpiTransaction t = request.getTransaction();
|
||||
|
||||
@@ -10,8 +10,6 @@ public class SimpleTextParser {
|
||||
private String word;
|
||||
private String lowerWord;
|
||||
|
||||
private int openParenthesisCount;
|
||||
|
||||
public SimpleTextParser(String oql) {
|
||||
this.oql = oql;
|
||||
this.chars = oql.toCharArray();
|
||||
@@ -104,7 +102,7 @@ public class SimpleTextParser {
|
||||
private void moveToClose() {
|
||||
|
||||
pos++;
|
||||
openParenthesisCount = 0;
|
||||
int openParenthesisCount = 0;
|
||||
|
||||
for (; pos < eof; pos++) {
|
||||
char c = chars[pos];
|
||||
|
||||
@@ -39,8 +39,6 @@ public class TCsvReader<T> implements CsvReader<T> {
|
||||
|
||||
private final CsvColumn ignoreColumn = new CsvColumn();
|
||||
|
||||
private boolean treatEmptyStringAsNull = true;
|
||||
|
||||
private boolean hasHeader;
|
||||
|
||||
private int logInfoFrequency = 1000;
|
||||
@@ -277,7 +275,7 @@ public class TCsvReader<T> implements CsvReader<T> {
|
||||
|
||||
strValue = strValue.trim();
|
||||
|
||||
if (strValue.length() == 0 && treatEmptyStringAsNull) {
|
||||
if (strValue.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@ public class JtaTransaction extends JdbcTransaction {
|
||||
|
||||
private UserTransaction userTransaction;
|
||||
|
||||
private DataSource dataSource;
|
||||
|
||||
private boolean commmitted = false;
|
||||
|
||||
private boolean newTransaction = false;
|
||||
@@ -27,8 +25,6 @@ public class JtaTransaction extends JdbcTransaction {
|
||||
public JtaTransaction(String id, boolean explicit, UserTransaction utx, DataSource ds, TransactionManager manager) {
|
||||
super(id, explicit, null, manager);
|
||||
userTransaction = utx;
|
||||
dataSource = ds;
|
||||
|
||||
try {
|
||||
newTransaction = userTransaction.getStatus() == Status.STATUS_NO_TRANSACTION;
|
||||
if (newTransaction) {
|
||||
@@ -40,7 +36,7 @@ public class JtaTransaction extends JdbcTransaction {
|
||||
|
||||
try {
|
||||
// Open JDBC Connection
|
||||
this.connection = dataSource.getConnection();
|
||||
this.connection = ds.getConnection();
|
||||
if (connection == null) {
|
||||
throw new PersistenceException("The DataSource returned a null connection.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user