// Init object
Object object = value;
- // Hard-coded "cast" again ... :-(
- // @TODO Can't we get rid of this???
- switch (type.getSimpleName()) {
- case "Long": // Long object //NOI18N
- object = Long.parseLong((String) value);
- break;
-
- case "Float": // Float object //NOI18N
- object = Float.parseFloat((String) value);
- break;
-
- case "Boolean": // Boolean object //NOI18N
- object = Boolean.parseBoolean((String) value);
- break;
-
- case "String": // String object //NOI18N
- break;
+ // Is the value null?
+ if ("null".equals(value)) { //NOI18N
+ // Warning message
+ this.getLogger().warn(MessageFormat.format("columnName={0} has null value.", columnName)); //NOI18N
- default: // Unsupported type
- throw new IllegalArgumentException(MessageFormat.format("value {0} has unsupported type {1}", value, type.getSimpleName())); //NOI18N
+ // Set null
+ object = null;
+ } else {
+ // Hard-coded "cast" again ... :-(
+ // @TODO Can't we get rid of this???
+ switch (type.getSimpleName()) {
+ case "Long": // Long object //NOI18N
+ object = Long.parseLong((String) value);
+ break;
+
+ case "Float": // Float object //NOI18N
+ object = Float.parseFloat((String) value);
+ break;
+
+ case "Boolean": // Boolean object //NOI18N
+ object = Boolean.parseBoolean((String) value);
+ break;
+
+ case "String": // String object //NOI18N
+ break;
+
+ default: // Unsupported type
+ throw new IllegalArgumentException(MessageFormat.format("value {0} has unsupported type {1}", value, type.getSimpleName())); //NOI18N
+ }
}
// Debug message
- this.getLogger().debug(MessageFormat.format("object[{0}]={1}", object.getClass().getSimpleName(), object)); //NOI18N
+ this.getLogger().debug(MessageFormat.format("object={0}", object)); //NOI18N
// Get method to call
Method method = this.getMethodFromName(instance, targetClass, methodName, type);
// Convert column_name to fieldName ;-)
String fieldName = this.convertColumnNameToFieldName(columnName);
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("fieldName={0}", fieldName)); //NOI18N
+
// Search for proper field instance
for (final Field field : fields) {
// Debug message
- this.getLogger().debug(MessageFormat.format("field={0},fieldName={1}", field, fieldName)); //NOI18N
+ this.getLogger().debug(MessageFormat.format("getName()={0},fieldName={1}", field.getName(), fieldName)); //NOI18N
// Does it match?
if (field.getName().equals(fieldName)) {
// Found it
type = field.getType();
+
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("Found fieldName={0}: setting type={1}", fieldName, type.getSimpleName())); //NOI18N
+
+ // Don't continue with searching
break;
}
}
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("type={0}", type));
+
// type should not be null
if (type == null) {
// No null allowed
}
// Debug message
- this.getLogger().debug("this.entrySet().size()=" + this.entrySet().size()); //NOI18N //NOI18N
+ this.getLogger().debug(MessageFormat.format("this.entrySet().size()={0}", this.entrySet().size())); //NOI18N //NOI18N
// No matches found?
if (this.entrySet().isEmpty()) {
Object value = storeable.getValueFromColumn(criteria.getKey());
// Debug message
- this.getLogger().debug(MessageFormat.format("value[{0}]={1}", value.getClass().getSimpleName(), value)); //NOI18N
+ this.getLogger().debug(MessageFormat.format("value={0},getValue()={1}", value, criteria.getValue())); //NOI18N
// Is both same?
- if (value.equals(criteria.getValue())) {
+ if (((null == value) && ("null".equals(criteria.getValue()))) || ((value != null) && (value.equals(criteria.getValue())))) { //NOI18N
// Debug message
this.getLogger().debug(MessageFormat.format("value={0} - MATCHES!", value)); //NOI18N