Instead of using the DLL as such, it seems that the desired architecture is of some kind.
One of the reasons I would not recommend using a DLL if necessary is that linking Java code with native code will require the use of the Java Native Interface (JNI), which is likely to require more effort than a pure Java solution.
One relatively easy way to do this is to use the reflection capabilities of Java.
From the above information, I would probably go along the following lines:
, , .
1:
, :
public interface Outputter {
public void write(Data d);
}
2.
.
public class TextOutputter {
public void write(Data d) {
}
}
, , class TextOutputter.class.
3.
TextOutputter.class classpath. , JVM , , class.
, , .
4.
, , - :
Class<?> clazz = Class.forName("TextOutputter");
Outputter outputter = clazz.newInstance();
outputter.write(...);
Class.forName TextOutputter ClassLoader. class, .
Class.newInstance. , , Constructor , .
, , Outputter, write TextOutputter.
, (, String, FQCN java.lang.String) - , .
, class .
( , , , , , , .)