Skip to content

zhaber/grules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grules is a rule engine for data preprocessing. The rules are specified via internal Groovy DSL, which has a concise and simple syntax. For example:

// isEmail is a Groovy/Java method that takes an email value as its parameter
email isEmail ["Invalid email"]

// invalidLoginMessage and dupLoginMessage are String error messages
login isLogin [invalidLoginMessage] >> isUnique [dupLoginMessage] 

// The value gender defaults to "MALE"
gender["MALE"] toEnum(Gender) 

// agreeToTerms is a message from a resource bundle
termsCondition[""] !isEmpty [m.agreeToTerms] 

// you can use closures as well
weight toPositiveBigDecimal [decimalErr] >> {round(it / 1000)} 

// Grules supports logical operators 
endDate isAfterNow && isBefore(deadline) && {it.day != 1}

To build the project, you should run the following command in the grules folder:

cd grules
./gradlew

To run hello world example:

cd grulesHelloWorld
./gradlew

Documentation:

Wiki documentation
White paper
Introduction video
Home page

Requirements: JVM 8, Groovy 2.3