this.getLogger().trace(MessageFormat.format("str={0}", str)); //NOI18N
// Is it null?
- if (str == null) {
+ if (null == str) {
// Return empty string
return ""; //NOI18N
}
this.getLogger().trace(MessageFormat.format("key={0},value={1} - CALLED!", key, value)); //NOI18N
// Both should not be null
- if (key == null) {
+ if (null == key) {
// key is null
throw new NullPointerException("key is null"); //NOI18N
- } else if (value == null) {
+ } else if (null == value) {
// value is null
throw new NullPointerException("value is null"); //NOI18N
}
this.getLogger().debug(MessageFormat.format("type={0}", type));
// type should not be null
- if (type == null) {
+ if (null == type) {
// No null allowed
throw new NullPointerException("type is null"); //NOI18N
}
this.getLogger().trace(MessageFormat.format("client={0} - CALLED!", client)); //NOI18N
// The client must be set
- if (client == null) {
+ if (null == client) {
// Not set
throw new NullPointerException("client is null"); //NOI18N
}
}
// Still null?
- if (g == null) {
+ if (null == g) {
// Didn't found a valid one
throw new IllegalArgumentException(MessageFormat.format("Gender {0} is invalid.", c));
}
* Checks logical match condition
*
* @param entrySet Entry set where the values are
- * @param criteraMatches Criteria matches
+ * @param criteriaMatches Criteria matches
* @return Whether it matches
*/
- public boolean matches (final Set<Map.Entry<String, Object>> entrySet, final Map<String, Boolean> criteraMatches);
+ public boolean matches (final Set<Map.Entry<String, Object>> entrySet, final Map<String, Boolean> criteriaMatches);
}
}
@Override
- public boolean matches (final Set<Map.Entry<String, Object>> entrySet, final Map<String, Boolean> criteraMatches) {
+ public boolean matches (final Set<Map.Entry<String, Object>> entrySet, final Map<String, Boolean> criteriaMatches) {
// Trace message
- this.getLogger().trace(MessageFormat.format("entrySet={0},criteriaMatches={1} - CALLED!", entrySet, criteraMatches)); //NOI18N
+ this.getLogger().trace(MessageFormat.format("entrySet={0},criteriaMatches={1} - CALLED!", entrySet, criteriaMatches)); //NOI18N
// Default is matching, then check if something is not matching and set result to false
boolean matches = true;
this.getLogger().debug(MessageFormat.format("entry.key={0},entry.value={1}", entry.getKey(), entry.getValue())); //NOI18N
// Check all matches
- for (Map.Entry<String, Boolean> criteriaMatch : criteraMatches.entrySet()) {
+ for (Map.Entry<String, Boolean> criteriaMatch : criteriaMatches.entrySet()) {
// Get key and value
String criteriaKey = criteriaMatch.getKey();
- Boolean criteriaMatches = criteriaMatch.getValue();
+ Boolean criteriaMatching = criteriaMatch.getValue();
// Debug message
- this.getLogger().debug(MessageFormat.format("criteriaKey={0},criteriaMatches={1}", criteriaKey, criteriaMatches)); //NOI18N
+ this.getLogger().debug(MessageFormat.format("criteriaKey={0},criteriaMatching={1}", criteriaKey, criteriaMatching)); //NOI18N
// Is both the same and false?
- if ((entry.getKey().equals(criteriaKey)) && (!criteriaMatches)) {
+ if ((entry.getKey().equals(criteriaKey)) && (!criteriaMatching)) {
// Debug message
- this.getLogger().debug("Not matching, aborting search.");
+ this.getLogger().debug("Not matching, aborting search."); //NOI18N
// Doesn't match
matches = false;
this.getLogger().trace(MessageFormat.format("storeable={0} - CALLED!", storeable)); //NOI18N
// Must not be null
- if (storeable == null) {
+ if (null == storeable) {
// Abort here
throw new NullPointerException("storeable is null"); //NOI18N
}
}
// Init matches array
- Map<String, Boolean> criteraMatches = new HashMap<>(this.entrySet().size());
+ Map<String, Boolean> criteriaMatches = new HashMap<>(this.entrySet().size());
// Check all conditions
for (final Map.Entry<String, Object> criteria : this.entrySet()) {
this.getLogger().debug(MessageFormat.format("value={0} - MATCHES!", value)); //NOI18N
// Matching criteria found
- criteraMatches.put(criteria.getKey(), true);
+ criteriaMatches.put(criteria.getKey(), true);
}
}
// Init matches
- boolean matches;
+ boolean matches = false;
// Is only one entry given?
if (this.entrySet().size() == 1) {
// Okay, one criteria only, no need for a "complex" logical match check
- matches = (criteraMatches.size() == 1);
+ matches = (criteriaMatches.size() == 1);
} else if (this.getLogical() == null) {
// Logical instance is null
- throw new NullPointerException(MessageFormat.format("logical is not set, but more than one column ({0}/{1}) shall be matched.", this.entrySet().size(), criteraMatches.size())); //NOI18N
- } else {
+ throw new NullPointerException(MessageFormat.format("logical is not set, but more than one column ({0}/{1}) shall be matched.", this.entrySet().size(), criteriaMatches.size())); //NOI18N
+ } else if (this.entrySet().size() == criteriaMatches.size()) {
// Debug message
- this.getLogger().debug(MessageFormat.format("entrySet.size()={0},criteriaMatches.size()={1} - Calling matches() on {2} ...", this.entrySet().size(), criteraMatches.size(), this.getLogical()));
+ this.getLogger().debug(MessageFormat.format("entrySet.size()={0},criteriaMatches.size()={1} - Calling matches() on {2} ...", this.entrySet().size(), criteriaMatches.size(), this.getLogical()));
// Now for the final test
- matches = this.getLogical().matches(this.entrySet(), criteraMatches);
+ matches = this.getLogical().matches(this.entrySet(), criteriaMatches);
}
// Trace message
this.getLogger().trace(MessageFormat.format("driverName={0} - CALLED!", driverName)); //NOI18N
// driverName shall not be null
- if (driverName == null) {
+ if (null == driverName) {
// Is null
throw new NullPointerException("driverName is null");
}
*
* The callee should not modify any content of the criteria instance.
*
- * @param critera Search critera
+ * @param criteria Search criteria
* @return A result instance
* @throws java.io.IOException If any IO error occurs
* @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
* @throws java.lang.IllegalAccessException If the method cannot be accessed
* @throws java.lang.reflect.InvocationTargetException Any other problems?
*/
- public Result<? extends Storeable> doSelectByCriteria (final SearchableCriteria critera) throws IOException, BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
+ public Result<? extends Storeable> doSelectByCriteria (final SearchableCriteria criteria) throws IOException, BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
/**
* Shuts down this backend
this.getLogger().trace(MessageFormat.format("dataset={0} - CALLED!", dataset)); //NOI18N
// dataset should not be null and not empty
- if (dataset == null) {
+ if (null == dataset) {
// It is null, so abort here
throw new NullPointerException("dataset is null"); //NOI18N
} else if (dataset.isEmpty()) {
}
@Override
- public Result<? extends Storeable> doSelectByCriteria (final SearchableCriteria critera) throws IOException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ public Result<? extends Storeable> doSelectByCriteria (final SearchableCriteria criteria) throws IOException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
// Trace message
- this.getLogger().trace(MessageFormat.format("criteria={0} - CALLED!", critera)); //NOI18N
+ this.getLogger().trace(MessageFormat.format("criteria={0} - CALLED!", criteria)); //NOI18N
// Init result instance
Result<? extends Storeable> result = new DatabaseResult();
this.getLogger().debug(MessageFormat.format("storeable={0}", storeable)); //NOI18N
// Now matches the found instance
- if (critera.matches(storeable)) {
+ if (criteria.matches(storeable)) {
// Then add it to result
result.add(storeable);
}
this.getLogger().debug(MessageFormat.format("line={0} - CALLED!", line)); //NOI18N
// "line" must not be null or empty
- if (line == null) {
+ if (null == line) {
// Is null
throw new NullPointerException("line is null"); //NOI18N
} else if (line.isEmpty()) {
String base64 = this.getStorageFile().readLine();
// Is the line null?
- if (base64 == null) {
+ if (null == base64) {
// Then throw NPE here
throw new NullPointerException("base64 is null, maybe missed to call isEndOfFile() ?"); //NOI18N
}
this.getLogger().trace(MessageFormat.format("output={0} - CALLED!", output)); //NOI18N
// No null or empty strings
- if (output == null) {
+ if (null == output) {
// Is null
throw new NullPointerException("output is null"); //NOI18N
} else if (output.length() == 0) {
this.getLogger().trace("CALLED!");
// Is the connection given?
- if (connection == null) {
+ if (null == connection) {
// Initial context
Context context = new InitialContext();
}
@Override
- public Result<? extends Storeable> doSelectByCriteria (final SearchableCriteria critera) throws IOException, BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- throw new UnsupportedOperationException("Not supported yet: criteria=" + critera); //To change body of generated methods, choose Tools | Templates.
+ public Result<? extends Storeable> doSelectByCriteria (final SearchableCriteria criteria) throws IOException, BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ throw new UnsupportedOperationException("Not supported yet: criteria=" + criteria); //To change body of generated methods, choose Tools | Templates.
}
@Override
this.getLogger().trace(MessageFormat.format("dataset={0} - CALLED!", dataset)); //NOI18N
// dataset should not be null and not empty
- if (dataset == null) {
+ if (null == dataset) {
// It is null, so abort here
throw new NullPointerException("dataset is null"); //NOI18N
} else if (dataset.isEmpty()) {
this.getLogger().debug(MessageFormat.format("value={0} - AFTER!", value)); //NOI18N
// Is the value null?
- if (value == null) {
+ if (null == value) {
// Add null
valueQuery.append("NULL,"); //NOI18N
} else {
}
@Override
- public Result<? extends Storeable> doSelectByCriteria (final SearchableCriteria critera) throws SQLException {
+ public Result<? extends Storeable> doSelectByCriteria (final SearchableCriteria criteria) throws SQLException {
// Trace message
- this.getLogger().trace(MessageFormat.format("criteria={0} - CALLED!", critera)); //NOI18N
+ this.getLogger().trace(MessageFormat.format("criteria={0} - CALLED!", criteria)); //NOI18N
// criteria must not be null
- if (critera == null) {
+ if (null == criteria) {
// Abort here
throw new NullPointerException("criteria is null"); //NOI18N
}
StringBuilder query = new StringBuilder(String.format("SELECT * FROM `%s`", this.getTableName())); //NOI18N
// Get entry set
- Set<Map.Entry<String, Object>> set = critera.entrySet();
+ Set<Map.Entry<String, Object>> set = criteria.entrySet();
// Debug message
this.getLogger().debug(MessageFormat.format("set.isEmpty()={0}", set.isEmpty())); //NOI18N
}
// Is limit set?
- if (critera.getLimit() > 0) {
+ if (criteria.getLimit() > 0) {
// Is skip set?
- if (critera.getSkip() > 0) {
+ if (criteria.getSkip() > 0) {
// Limit with skip
- query.append(String.format(" LIMIT %d,%d", critera.getSkip(), critera.getLimit())); //NOI18N
+ query.append(String.format(" LIMIT %d,%d", criteria.getSkip(), criteria.getLimit())); //NOI18N
} else {
// Only limit
- query.append(String.format(" LIMIT %d", critera.getLimit())); //NOI18N
+ query.append(String.format(" LIMIT %d", criteria.getLimit())); //NOI18N
}
}
// Found ineteger
statement.setFloat(index, (float) value);
- } else if (value == null) {
+ } else if (null == value) {
// Debug message
this.getLogger().warn(MessageFormat.format("Null value in index={0} is not supported (yet)", index)); //NOI18N
} else {
this.getLogger().trace(MessageFormat.format("key={0},value={1} - CALLED!", key, value)); //NOI18N
// Is key null?
- if (key == null) {
+ if (null == key) {
// Key is null
throw new NullPointerException("key is null"); //NOI18N
- } else if (value == null) {
+ } else if (null == value) {
// Issue warning about null reference
this.getLogger().warn(MessageFormat.format("value for key={0} is null, this may cause problems.", key));
}
factory.getLogger().trace(MessageFormat.format("frontend={0} - CALLED!", frontend)); //NOI18N
// frontend must be set
- if (frontend == null) {
+ if (null == frontend) {
// Is null
throw new NullPointerException("frontend is null");
}
*/
public static final ManageableApplication getManager (final Application application) {
// Application instance must be set
- if (application == null) {
+ if (null == application) {
// Abort here
throw new NullPointerException("application is null"); //NOI18N
}
*/
private ApplicationManager (final Application application) {
// Application instance must be set
- if (application == null) {
+ if (null == application) {
// Abort here
throw new NullPointerException("application is null"); //NOI18N
}
this.getLogger().trace("listener=" + listener + " - CALLED!"); //NOI18N
// Listener must not be null
- if (listener == null) {
+ if (null == listener) {
// Abort here
throw new NullPointerException("listener is null");
}
this.getLogger().trace("listener=" + listener + " - CALLED!"); //NOI18N
// Listener must not be null
- if (listener == null) {
+ if (null == listener) {
// Abort here
throw new NullPointerException("listener is null");
}
this.getLogger().trace("listener=" + listener + " - CALLED!"); //NOI18N
// Listener must not be null
- if (listener == null) {
+ if (null == listener) {
// Abort here
throw new NullPointerException("listener is null");
}
this.getLogger().trace("listener=" + listener + " - CALLED!"); //NOI18N
// Listener must not be null
- if (listener == null) {
+ if (null == listener) {
// Abort here
throw new NullPointerException("listener is null");
}
this.getLogger().trace(MessageFormat.format("client={1} - CALLED!", client)); //NOI18N
// Client must not be null
- if (client == null) {
+ if (null == client) {
// Abort here
throw new NullPointerException("client is null"); //NOI18N
}