In an attempt to write some generic code I find myself putting, in my abstract class, a method that returns some static information about how the class should be treated. This method doesn't use any state data and would be static, except that static abstract methods aren't allowed. Is this a code smell? is there something one should do to avoid this?
I haven't writtent he real code yet. Here is a quick example, conceptually. Little slopy programing wise to make to make it a quick read. basically a way for the code to return information to the model, in this case, about how it should be treated within the generic functions of the model. Assume the enum stored whatever configuration state in this case.
public abstract modelObject{
public abstract ModelGroup getModelGroup;
public final void addToModel(){
Model.store(this.getModelGroup, this);
}
}
public class myObject extends modelObject{
public ModelGroup getModelGroup(){
return ModelGroup.MyGroup;
}
}
public class DifferentClass extends ModelObject{
public ModelGroup getModelGroup(){
return ModelGroup.differentGroup;
}
}