NIHVIVO-2479 Small improvements to dump output

This commit is contained in:
ryounes 2011-04-22 20:27:55 +00:00
parent 8f0b6f7b01
commit 0926e5cc30
6 changed files with 39 additions and 17 deletions

View file

@ -52,8 +52,6 @@ public abstract class BaseDumpDirective implements TemplateDirectiveModel {
private static final String TEMPLATE_DEFAULT = "dump1.ftl"; // change to dump.ftl when old dump is removed
private static final Pattern PROPERTY_NAME_PATTERN = Pattern.compile("^(get|is)\\w");
protected static final String VALUE_UNDEFINED = "Undefined";
enum Key {
DATE_TYPE("dateType"),
@ -73,6 +71,21 @@ public abstract class BaseDumpDirective implements TemplateDirectiveModel {
return key;
}
}
enum Value {
NULL("[null]"),
UNDEFINED("[undefined]");
private final String value;
Value(String value) {
this.value = value;
}
public String toString() {
return value;
}
}
enum Type {
BOOLEAN("Boolean"),
@ -129,7 +142,7 @@ public abstract class BaseDumpDirective implements TemplateDirectiveModel {
Map<String, Object> value = new HashMap<String, Object>();
if (model == null) {
value.put(Key.VALUE.toString(), VALUE_UNDEFINED);
value.put(Key.VALUE.toString(), Value.UNDEFINED);
// TemplateMethodModel and TemplateDirectiveModel objects can only be
// included in the data model at the top level.
@ -196,7 +209,7 @@ public abstract class BaseDumpDirective implements TemplateDirectiveModel {
map.putAll( getTemplateModelDump( (TemplateModel)model ) );
}
} else {
map.put(Key.VALUE.toString(), "null");
map.put(Key.VALUE.toString(), Value.NULL);
}
return map;