getExpectedFormat
This commit is contained in:
@@ -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)?
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user