I want to create a class that would provide me with a card i.e
Card c = new Card(1) // where the builder should get values 1 to 4, representing 1=spade, 2=heart, 3=diamond, 4=clubs
c.getType() // spade
I want the class to check during compilation time whether the card is of type spade, heart, diamond or club, and if not - it'll raise an error and won't let me compile. The class should NOT use enum
Edit: This question is asked solely for the purpose of understanding how would one answer that kind of question in the pre-enum era. I was asked this question during a job interview a couple of years ago