There's a pattern I've noticed in Java, and I was wondering if there's a name for it so I can look up implementations in other languages.
I've seen static final fields of a class used as method arguments. This limits the caller of the method to a public set of values for that argument. For example:
public class Calendar {
public static final int JANUARY = 1;
public static final int FEBRUARY = 1;
//and so on
public void setMonth(int month){
//set month
}
}
Calendar c = new Calendar();
c.setMonth(Calendar.JANUARY);
Is there a name for this pattern? Thanks...
(example edited to working code, been a long time since I wrote Java)