alizelzele alizelzele - 1 year ago 109
Java Question

any simple key value pojo in java


As Nick has said below, there is no library like that in Java 8 ( with a nice explanation on the reason ),
my question was about Spring-mvc, which contains lots of additional dependencies.

The question might sound ridiculous. But almost in every web application there are some simple pojos required as a response model. The most used one in my applications is

public SimpleKeyValue {
private String key;
private String value;

(getters and setters)

This class is usually used as a list response, something like:

public List<SimpleKeyValue> someRestMethod() {

I was wondering if there are any Pojos similar to this class in Java or Spring ( spring-boot-web-starter and its dependencies, to be more clear ).

P.S: One obvious way is to use map, which generate JSON like
{key1:value1, key2:value2}
and it is nice, but it is not the output I want.

Answer Source
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download