Skip to content

Instantly share code, notes, and snippets.

@mathieuancelin
Created January 27, 2012 10:09
Show Gist options
  • Save mathieuancelin/1688118 to your computer and use it in GitHub Desktop.
Save mathieuancelin/1688118 to your computer and use it in GitHub Desktop.
public class Configuration {
public boolean loggingEnabled = false;
public boolean someOptimizationEnabled = false;
public boolean someStuffEnabled = false;
}
@Inject Event<Configuration> configEvt;
public void customConfiguration() {
Configuration config = new Configuration();
configEvent.fire(configuration);
if (configuration.logginEnabled) { /** Do stuff **/ }
if (configuration.someOptimizationEnabled) { /** Do stuff **/ }
if (configuration.someStuffEnabled) { /** Do stuff **/ }
}
public void configure(@Observes Configuration configuration) {
configuration.logginEnabled = true;
configuration.someStuffEnabled = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment