Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support for Mapping from Map<String, ???> to Bean #1075

Closed
@twothe

Description

@twothe

Refering to Stack-Overflow

The situation is: I have a REST service that must be called with a huge amount of parameters (as by customer request) and those should be stored in a database. The easiest way to do that would be to take the parameter map and map that to an entity object. As it is about the same type of code to map from an object to and object or from a map to an object I assume it should not be too difficult to allow mapping like this:

public MyEntity mapToEntity(final Map<String, String> parameters);

Essentially that should turn into code like this:

myEntity.setName( parameters.get("name") );
myEntity.setReferrer( stringToReferrer( parameters.get("referrer") ) );
//...

It would be nice to have other variable types supported as well, like Map<String, Object>, but I am not sure at which point it becomes too complicated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions