提交 db40e15a 编写于 作者: K Keith Donald

polish

上级 2381452e
......@@ -22,7 +22,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* A type that can be formatted as a String for display in a UI.
* A type that can be formatted as a String for display in a user interface.
* @author Keith Donald
* @since 3.0
*/
......
......@@ -56,6 +56,7 @@ public interface FormatterRegistry {
* Get the Formatter for the type.
* @return the Formatter, or <code>null</code> if none is registered
*/
@SuppressWarnings("unchecked")
Formatter getFormatter(TypeDescriptor type);
}
......@@ -42,6 +42,8 @@ public class GenericFormatterRegistry implements FormatterRegistry {
private Map<Class, AnnotationFormatterFactory> annotationFormatters = new HashMap<Class, AnnotationFormatterFactory>();
// implementing FormatterRegistry
public <T> void add(Formatter<T> formatter) {
// TODO
}
......
......@@ -26,13 +26,13 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.ui.format.Formatter;
/**
* A formatter for {@link Date} types.
* A formatter for {@link java.util.Date} types.
* Allows the configuration of an explicit date pattern and locale.
* @author Keith Donald
* @since 3.0
* @see SimpleDateFormat
*/
public class DateFormatter implements Formatter<Date> {
public final class DateFormatter implements Formatter<Date> {
private static Log logger = LogFactory.getLog(DateFormatter.class);
......@@ -66,9 +66,9 @@ public class DateFormatter implements Formatter<Date> {
return getDateFormat(locale).parse(formatted);
}
// subclassing hookings
// internal helpers
protected DateFormat getDateFormat(Locale locale) {
private DateFormat getDateFormat(Locale locale) {
DateFormat format = DateFormat.getDateInstance(DateFormat.SHORT, locale);
format.setLenient(false);
if (format instanceof SimpleDateFormat) {
......@@ -81,8 +81,6 @@ public class DateFormatter implements Formatter<Date> {
return format;
}
// internal helpers
private String determinePattern(String pattern) {
return pattern != null ? pattern : DEFAULT_PATTERN;
}
......
......@@ -33,7 +33,7 @@ import org.springframework.ui.format.Formatter;
* @author Keith Donald
* @since 3.0
*/
public class CurrencyFormatter implements Formatter<BigDecimal> {
public final class CurrencyFormatter implements Formatter<BigDecimal> {
private CurrencyNumberFormatFactory currencyFormatFactory = new CurrencyNumberFormatFactory();
......
......@@ -31,7 +31,7 @@ import org.springframework.ui.format.Formatter;
* @author Keith Donald
* @since 3.0
*/
public class DecimalFormatter implements Formatter<BigDecimal> {
public final class DecimalFormatter implements Formatter<BigDecimal> {
private DefaultNumberFormatFactory formatFactory = new DefaultNumberFormatFactory();
......
......@@ -28,7 +28,7 @@ import org.springframework.ui.format.Formatter;
* @author Keith Donald
* @since 3.0
*/
public class IntegerFormatter implements Formatter<Long> {
public final class IntegerFormatter implements Formatter<Long> {
private IntegerNumberFormatFactory formatFactory = new IntegerNumberFormatFactory();
......
......@@ -30,7 +30,7 @@ import org.springframework.ui.format.Formatter;
* @author Keith Donald
* @since 3.0
*/
public class PercentFormatter implements Formatter<BigDecimal> {
public final class PercentFormatter implements Formatter<BigDecimal> {
private PercentNumberFormatFactory percentFormatFactory = new PercentNumberFormatFactory();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册