Skip to content

Commit e0a0856

Browse files
committed
Address PR comments (#320)
1 parent 8ca3bf3 commit e0a0856

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/main/java/com/fasterxml/jackson/annotation/JsonFormat.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,8 @@
8181
public final static String DEFAULT_TIMEZONE = "##default";
8282

8383
/**
84-
* Value that indicates the default radix(numeric base) should be used when outputting
85-
* {@link java.lang.Number} properties when {@link Shape#STRING} is specified.
86-
* This is a marker signaling that {@link JsonFormat.Value} with this radix should
87-
* not override the radix of another {@link JsonFormat.Value}.
84+
* This is a marker signaling that a configured default radix should be used, which typically means 10,
85+
* when serializing {@link java.lang.Number} properties with {@link Shape#STRING}.
8886
* @since 2.21
8987
*/
9088
public final static int DEFAULT_RADIX = -1;
@@ -764,7 +762,7 @@ public static Value forLeniency(boolean lenient) {
764762
/**
765763
* @since 2.21
766764
*/
767-
public static Value forRadix(byte radix) {
765+
public static Value forRadix(int radix) {
768766
return new Value("", null, null, null, null, Features.empty(),
769767
null, radix);
770768
}
@@ -818,7 +816,7 @@ public Value withLenient(Boolean lenient) {
818816
/**
819817
* @since 2.21
820818
*/
821-
public Value withRadix(byte radix) {
819+
public Value withRadix(int radix) {
822820
if (radix == _radix) {
823821
return this;
824822
}
@@ -949,12 +947,12 @@ public boolean hasLenient() {
949947
}
950948

951949
/**
952-
* Accessor for checking whether non-default (neither special default marker -1 nor 10) radix has been specified.
950+
* Accessor for checking whether non-default radix has been specified.
953951
*
954952
* @since 2.21
955953
*/
956954
public boolean hasNonDefaultRadix() {
957-
return _radix != DEFAULT_RADIX && _radix != 10;
955+
return _radix != DEFAULT_RADIX;
958956
}
959957

960958
/**

src/test/java/com/fasterxml/jackson/annotation/JsonFormatTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ public void testEquality() {
6565

6666
@Test
6767
public void testToString() {
68-
assertEquals("JsonFormat.Value(pattern=,shape=STRING,lenient=null,locale=null,timezone=null,features=EMPTY,radix=10)",
68+
assertEquals("JsonFormat.Value(pattern=,shape=STRING,lenient=null,locale=null,timezone=null,features=EMPTY,radix=-1)",
6969
JsonFormat.Value.forShape(JsonFormat.Shape.STRING).toString());
70-
assertEquals("JsonFormat.Value(pattern=[.],shape=ANY,lenient=null,locale=null,timezone=null,features=EMPTY,radix=10)",
70+
assertEquals("JsonFormat.Value(pattern=[.],shape=ANY,lenient=null,locale=null,timezone=null,features=EMPTY,radix=-1)",
7171
JsonFormat.Value.forPattern("[.]").toString());
7272
}
7373

0 commit comments

Comments
 (0)