This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static AtomicInteger counter = new AtomicInteger(1); | |
public static final String user1JsonStart = "{\n" | |
+ " \"name\" : { \"first\" : \"Joe\", \"last\" : \"Sixpack"; | |
public static final String user1JsonEnd = "\" },\n" | |
+ " \"gender\" : \"MALE\",\n" | |
+ " \"verified\" : false,\n" | |
+ " \"userImage\" : \"Rm9vYmFyIQ==\"\n" | |
+ "}"; | |
@Benchmark | |
public User jsonUnmashal() throws Exception { | |
ObjectMapper mapper = new ObjectMapper(); | |
StringBuilder jsonUser = new StringBuilder(); | |
//build new Json String | |
jsonUser.append(user1JsonStart).append(counter.incrementAndGet()).append(user1JsonEnd); | |
User user = mapper.readValue(jsonUser.toString(), User.class); | |
return user; | |
} |
lajospajtek
commented
Jul 27, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment