K
K
kirawa2017-07-08 18:09:18
Java
kirawa, 2017-07-08 18:09:18

How to pass a dynamic parameter and instantiate it?

There are several classes with the same constructors - let's call them Adapters. I want to create a Loader class that would take one of the Adapters as input and create an instance of it by filling in the parameters. How to do this please tell me.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey K, 2017-07-09
@kuftachev

An adapter is a pattern that allows you to convert one interface to another.
ClassLoader is a special Java class that loads other Java classes into memory.
To create objects of different types depending on the conditions, use the Factory Method or Abstract Factory.
In general, learn to call a spade a spade and immediately everything falls into the right place.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question