You could create a "type" in the teacher class where it would be an Enum and there put a logic where it would receive a characteristic interface with its specialties.
I’ll post an example of code that’s easier to understand.
public class Professor {
TipoProfessor tipo;
public TipoProfessor getTipo() {
return tipo;
}
}
Type
public enum TipoProfessor {
MATEMATICA(new DobrarPontos()), HISTORIA(new ZerarPontos()), GEOGRAFIA(new AumentarPoder());
private Caracteristica caracteristica;
private TipoProfessor(Caracteristica caracteristica) {
this.caracteristica = caracteristica;
}
public Caracteristica getCaracteristica() {
return caracteristica;
}
}
Characteristic interface
public interface Caracteristica {
void getCaracteristica();
}
Specialties
public class AumentarPoder implements Caracteristica {
@Override
public void getCaracteristica() {
System.out.println("Aumentar força");
}
}
public class DobrarPontos implements Caracteristica {
@Override
public void getCaracteristica() {
System.out.println("Dobrar pontos");
}
}
public class ZerarPontos implements Caracteristica {
@Override
public void getCaracteristica() {
System.out.println("Zerar pontos");
}
}
Basically the idea is this, you just have to think of a domain name that makes more sense to you.
"I don’t need the code, just an idea of how to differentiate the types of each teacher" I understand you’re a model, but isn’t there anything you’ve done to put the question? could create a base class "Teacher", with association to for "Materia" and make the other specific classes inherit from Teacher, as "Professormatematica"
– Ricardo Pontual