protected synchronized String getConfig(String config) { String value = configurationFactory.getProperties().get(config); configurationFactory.consumeProperty(config); return value; }
@Override public final synchronized void configure(Binder binder) { checkState(this.binder == null, "re-entry not allowed"); this.binder = checkNotNull(binder, "binder is null"); try { ConditionalModule annotation = this.getClass().getAnnotation(ConditionalModule.class); if (annotation != null) { configurationFactory.consumeProperty(annotation.config()); String value = Optional.ofNullable(configurationFactory.getProperties().get(annotation.config())) .map(v -> v.trim()).orElse(null); if (!Objects.equals(annotation.value(), value)) { if(!(annotation.value().equals("") && value != null)) { return; } } } setup(binder); } finally { this.binder = null; } }
@Override public void setConfigurationFactory(ConfigurationFactory configurationFactory) { this.configurationFactory = checkNotNull(configurationFactory, "configurationFactory is null"); configurationFactory.consumeProperty(property); }