Skip to content

Commit

Permalink
Merge branch '2.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Aug 30, 2019
2 parents f57e6a8 + daa935c commit f75b304
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ public void setXyz(int x) {
}
}

static class AliasBean2378 {
String partitionId;
String _id;

private AliasBean2378(boolean bogus, String partId, String userId) {
partitionId = partId;
_id = userId;
}

@JsonCreator
public static AliasBean2378 create(@JsonProperty("partitionId") String partId,
@JsonProperty("id") @JsonAlias("userId") String userId) {
return new AliasBean2378(false, partId, userId);
}
}

static class PolyWrapperForAlias {
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.WRAPPER_ARRAY)
Expand Down Expand Up @@ -81,4 +97,14 @@ public void testAliasWithPolymorphic() throws Exception
assertEquals("Bob", bean.name);
assertEquals(17, bean._a);
}

// [databind#2378]
public void testAliasInFactoryMethod() throws Exception
{
AliasBean2378 bean = MAPPER.readValue(aposToQuotes(
"{'partitionId' : 'a', 'userId' : '123'}"
), AliasBean2378.class);
assertEquals("a", bean.partitionId);
assertEquals("123", bean._id);
}
}

0 comments on commit f75b304

Please sign in to comment.