removed framework specific annotation in favor of user-defined for now

This commit is contained in:
Keith Donald
2009-08-19 15:02:50 +00:00
parent 704cc79cee
commit 2bd664f7ee
3 changed files with 19 additions and 42 deletions

View File

@@ -3,6 +3,11 @@ package org.springframework.ui.format;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.ParseException;
@@ -12,7 +17,6 @@ import org.junit.Before;
import org.junit.Test;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.style.ToStringCreator;
import org.springframework.ui.format.number.CurrencyFormat;
import org.springframework.ui.format.number.CurrencyFormatter;
import org.springframework.ui.format.number.IntegerFormatter;
@@ -73,7 +77,7 @@ public class GenericFormatterRegistryTests {
registry.add(Integer.class, new AddressFormatter());
}
@CurrencyFormat
@Currency
public BigDecimal currencyField;
private static TypeDescriptor typeDescriptor(Class<?> clazz) {
@@ -81,11 +85,11 @@ public class GenericFormatterRegistryTests {
}
public static class CurrencyAnnotationFormatterFactory implements
AnnotationFormatterFactory<CurrencyFormat, BigDecimal> {
AnnotationFormatterFactory<Currency, BigDecimal> {
private CurrencyFormatter currencyFormatter = new CurrencyFormatter();
public Formatter<BigDecimal> getFormatter(CurrencyFormat annotation) {
public Formatter<BigDecimal> getFormatter(Currency annotation) {
return currencyFormatter;
}
}
@@ -161,5 +165,12 @@ public class GenericFormatterRegistryTests {
}
}
@Target( { ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Currency {
}
}