removed framework specific annotation in favor of user-defined for now
This commit is contained in:
@@ -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 {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user