Refactoring a class / map of query parameters that are passed between layers There is an interface:

interface JournalCreator {

    @Async
    Journal create(Parameters params);
}


And many different implementations:

class CarsJournal implements JournalCreator {

    @Autowired
    private JournalRepo journalRepo;

    @Override
    public Journal create(Parameters params) {
        String name = params.getName();
        long id = params.getId();
        // do something with name / id
        // ...
        return journalRepo.getCars(name, id);
    }
}

class MotoJournal implements JournalCreator {

    @Autowired
    private JournalRepo journalRepo;

    @Override
    public Journal create(Parameters params) {
        return journalRepo.getMoto(params.getName(),
                                   params.getId(),
                                   params.getAge(),
                                   params.getColor());
    }
}


The problem is that Parameters class acts like a container for all possible parameters that could be passed to different methods in different controllers:

class Parameters {

    private String name;
    private long id;
    private int age;
    private Color color;

    // dozens of other fields
    // getters and setters
}


One of many controllers example:

@RestController
class CarsController {

    private JournalCreator carsJCreator;

    @Autowired
    public JournalController(JournalCreator carsJCreator) {
        this.carsJCreator = carsJCreator;
    }

    @RequestMapping("...")
    public Journal createCarsJournal(@RequestBody Parameters params) {
        return carsJCreator.create(params);
    }
}


The Parameters class became some kind of a god-object that holds too may different parameters. Also, this is inefficient in terms of memory, because most often only several parameters are used to be passed between different layers.

There could be the Map&lt;String, Object&gt; params instead of Parameters, but I also don't like this idea too much, because it requires a bunch of casts (and it's a bad practice to use an Object as a generic type).

Are there any other alternatives of how to deal with such variations of parameters?
It's cleaner and possible to create types of Parameter class, such as CarParameter, MotoParameter, and use Spring type conversion. 

First your signature would become something like 

@RequestMapping(".../car/...")
public Journal createCarsJournal(@RequestParam CarParameter params) {
    return carsJCreator.create(params);
}

@RequestMapping(".../moto/...")
public Journal createMotosJournal(@RequestParam MotoParameter params) {
    return motosJCreator.create(params);
}


To build the customized conversion, check out Guide to Spring Type Conversions.