Skip to content

How to pass multiple values to a Map? #753

@feinstein

Description

@feinstein

I have a Map<String, Object> object that's supposed to hold variables such as "role","admin", "level","10", "enabled","true".

I tried to define it like:

@Option(names = {"-m", "--map"}, description = "A map of values.")
    private Map<String, Object> myMap;

And call it like this in cli:

-m role=admin,level=10,enabled=true

But this results in a map of: "role" -> "admin,level=10,enabled=true"

What's the correct way to call it in the cli to get the full map of values?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions