No effective change - Code cleanup, simplified if

This commit is contained in:
Robin Bygrave
2015-07-31 13:23:49 +12:00
parent 88340618af
commit adef15ce2b
14 changed files with 19 additions and 79 deletions
@@ -107,10 +107,7 @@ class DRawSqlParser {
if (placeHolderHaving > -1) {
return true;
}
if (placeHolderAndHaving > -1) {
return true;
}
return false;
return placeHolderAndHaving > -1;
}
/**
@@ -272,10 +272,7 @@ public abstract class AbstractNamingConvention implements NamingConvention {
* Checks string is null or empty .
*/
protected boolean isEmpty(String s) {
if (s == null || s.trim().length() == 0) {
return true;
}
return false;
return s == null || s.trim().length() == 0;
}
/**
@@ -144,13 +144,7 @@ final class PropertyExpression {
}
private static boolean isJndiExpression(String exp) {
if (exp.startsWith("JNDI:")) {
return true;
}
if (exp.startsWith("jndi:")) {
return true;
}
return false;
return exp.startsWith("JNDI:") || exp.startsWith("jndi:");
}
/**
@@ -155,10 +155,7 @@ public class StringHelper {
* Return true if the value is null or an empty string.
*/
public static boolean isNull(String value) {
if (value == null || value.trim().length() == 0) {
return true;
}
return false;
return value == null || value.trim().length() == 0;
}
/**
@@ -160,11 +160,7 @@ public class InternalConfiguration {
return true;
}
DataSource dataSource = serverConfig.getDataSource();
if (dataSource instanceof DataSourcePool && ((DataSourcePool)dataSource).getAutoCommit()) {
// We know the DataSourcePool is using autoCommit
return true;
}
return false;
return dataSource instanceof DataSourcePool && ((DataSourcePool) dataSource).getAutoCommit();
}
public JsonContext createJsonContext(SpiEbeanServer server) {
@@ -23,11 +23,7 @@ public class AddForeignKeysVisitor extends AbstractBeanVisitor {
}
public boolean visitBean(BeanDescriptor<?> descriptor) {
if (!descriptor.isInheritanceRoot()) {
// ignore/skip if not a top level BeanDescriptor
return false;
}
return true;
return descriptor.isInheritanceRoot();
}
public void visitBeanEnd(BeanDescriptor<?> descriptor) {
@@ -149,11 +149,8 @@ public class DRawSqlSelectBuilder {
if (placeHolderHaving > -1) {
return true;
}
if (placeHolderAndHaving > -1) {
return true;
}
return false;
}
return placeHolderAndHaving > -1;
}
/**
* Trim off the select keyword (to support row_number() limit function).
@@ -215,11 +215,8 @@ public final class DRawSqlSelectColumnsParser {
if (columnLabel.equalsIgnoreCase(prop.getDbColumn())) {
return true;
}
if (columnLabel.equalsIgnoreCase(prop.getName())) {
return true;
}
return false;
}
return columnLabel.equalsIgnoreCase(prop.getName());
}
private int nextComma() {
boolean inQuote = false;
@@ -167,20 +167,10 @@ public abstract class DeployParser {
} else if (ch == UNDERSCORE) {
return true;
} else if (ch == PERIOD) {
return true;
} else {
return false;
}
} else return ch == PERIOD;
}
private boolean isWordStart(char ch) {
if (Character.isLetter(ch)) {
return true;
} else {
return false;
}
return Character.isLetter(ch);
}
}
@@ -32,10 +32,7 @@ public abstract class AnnotationBase {
* Checks string is null or empty .
*/
protected boolean isEmpty(String s) {
if (s == null || s.trim().length() == 0) {
return true;
}
return false;
return s == null || s.trim().length() == 0;
}
@@ -155,11 +155,8 @@ public class StringHelper {
* Return true if the value is null or an empty string.
*/
public static boolean isNull(String value) {
if (value == null || value.trim().length() == 0) {
return true;
}
return false;
}
return value == null || value.trim().length() == 0;
}
/**
* Recursively pulls out the key value pairs from a raw string.
@@ -357,10 +357,7 @@ public class OrmQueryDetail implements Serializable {
* Return true if this is actually the root level of a +query/+lazy loading query.
*/
private boolean isLazyLoadManyRoot(String lazyLoadManyPath, OrmQueryProperties chunk) {
if (lazyLoadManyPath != null && lazyLoadManyPath.equals(chunk.getPath())) {
return true;
}
return false;
return lazyLoadManyPath != null && lazyLoadManyPath.equals(chunk.getPath());
}
/**
@@ -184,15 +184,6 @@ public class OrmQueryDetailParser {
}
private boolean isFindFetchEnd() {
if (isFetch()) {
return true;
}
if (parser.isMatch("where")) {
return true;
}
if (parser.isMatch("order", "by")) {
return true;
}
return false;
return isFetch() || parser.isMatch("where") || parser.isMatch("order", "by");
}
}
@@ -245,11 +245,8 @@ public class TCsvReader<T> implements CsvReader<T> {
}
private boolean isDateTimeType(int t) {
if (t == Types.TIMESTAMP || t == Types.DATE || t == Types.TIME) {
return true;
}
return false;
}
return t == Types.TIMESTAMP || t == Types.DATE || t == Types.TIME;
}
@SuppressWarnings("unchecked")
protected T buildBeanFromLineContent(int row, String[] line) {