This is a feature toggles library that is super simple and easy to understand. Go ahead, just read the source.
Add this to your pom.xml
<dependency>
<groupId>com.activitystream</groupId>
<artifactId>rofi</artifactId>
<version>check the maven badge above to find the latest version</version>
</dependency>