Skip to content

Instantly share code, notes, and snippets.

@danveloper
Created December 23, 2012 04:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danveloper/4362001 to your computer and use it in GitHub Desktop.
Save danveloper/4362001 to your computer and use it in GitHub Desktop.
Example student entity for rules engine post
class Student {
enum DormHall {
Honors, Preferred, Normal
}
def firstName
def lastName
def gpa
// We only want dormHall to be assigned when it is deliberate, so throw an exception when
// it is accidentally assigned outside of our rules engine
private def dormHall
public void setDormHall() {
throw new RuntimeException("Student dorm hall is not directly assignable.")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment