preferences added

This commit is contained in:
serso
2011-09-26 23:46:47 +04:00
parent 41ce099dd2
commit 90fb6cf109
27 changed files with 404 additions and 133 deletions

View File

@@ -16,8 +16,19 @@ import org.solovyev.common.utils.Formatter;
*/
public class ValueOfFormatter<T> implements Formatter<T>{
private final boolean processNulls;
public ValueOfFormatter() {
this(false);
}
public ValueOfFormatter(boolean processNulls) {
this.processNulls = processNulls;
}
@Override
public String formatValue(@Nullable T t) throws IllegalArgumentException {
return String.valueOf(t);
return t == null ? (processNulls ? String.valueOf(t) : null) : String.valueOf(t);
}
}