getExpectedFormat

This commit is contained in:
Keith Donald
2008-03-23 05:04:23 +00:00
parent c72144fe8a
commit 94b401c917
3 changed files with 10 additions and 4 deletions

View File

@@ -85,11 +85,9 @@ public abstract class AbstractFormatter implements Formatter {
}
/**
* Returns the expected string format for the given target class. The default implementation just returns null.
* Returns the expected string format for the given target class.
*/
protected String getExpectedFormat() {
return null;
}
protected abstract String getExpectedFormat();
/**
* Is given object <i>empty</i> (null or empty string)?

View File

@@ -55,6 +55,10 @@ public class DateFormatterFactory implements FormatterFactory {
return dateFormat.parse(formattedString);
}
protected String getExpectedFormat() {
return dateFormat.toString();
}
public String toString() {
return new ToStringCreator(this).append("format", dateFormat).toString();
}

View File

@@ -72,6 +72,10 @@ public class NumberFormatterFactory implements FormatterFactory {
}
}
protected String getExpectedFormat() {
return numberFormat.toString();
}
public String toString() {
return new ToStringCreator(this).append("format", numberFormat).append("targetClass", targetClass)
.toString();