I have an Operator interface for handling math operator that has two method like so:
public interface Operator
{
double calculate(double firstNumber,double secondNumber);
char getSign();
}
for each operator I have a class that implement Operator interface like so:
public class Plus implements Operator
{
public double calculate(double firstNumber,double secondNumber)
{
return firstNumber + secondNumber;
}
public char getSign()
{
return '+';
}
}
And so on... In this code I use Reflections :
Reflections reflections = new Reflections("mypackage");
Set<Class<? extends Operator>> classes = reflections.getSubTypesOf(Operator.class);
Reflections is not the part of java Reflection API.I should just use java Reflection capability. Can anyone help me to change this code that only use java Reflection API?