In general, if the type is just a piece of information, you make it a field. If it's used to change the behavior of the methods like
public void foo() {
if (type == PEER) {
doSomething();
}
else {
doSomethingElse();
}
}
then it's an indication that you should subclass, and use polymorphism to get the appropriate behavior depending on the type. Another solution is to use delegation rather than inheritance, and to associate behavior to the type:
public enum EvaluationType {
PEER {
@Override
public void foo() {
...
}
},
TEAM {
@Override
public void foo() {
...
}
};
public abstract void foo();
}
public class Evaluation {
private EvaluationType type;
public void foo() {
return this.type.foo();
}
}