I have interface and its implementations:
public interface SyntaxConstruction{
public String parseFromString(String str);
}
public class Copy implements SyntaxConstruction{
public String parseFromString(String str){ //impl };
}
public class Set implements SyntaxConstruction{
public String parseFromString(String str){ //impl };
}
I also have the following class:
public class Parser{
private static List<SyntaxElement> elementPrototypes; //should maintain the list of all implementation's prototypes
static{
//Initializing list with prtotypes of all possible SyntaxConstruction's implementations
}
public static List<SyntaxElement> parse(String str){
//getting syntax elements from str
}
}
Now we add a new implementation, say
public class Values implements SyntaxConstruction{
public String parseFromString(String str){ //impl };
}
If the user who add the class don't update the elementPrototypes
list it may lead to hardly-catched bugs. I'd like to make them be awared of updating the list safely?