private void installBootstrapConfigurationService(WeldDeployment deployment, DeploymentUnit parentDeploymentUnit) { final boolean nonPortableMode = parentDeploymentUnit.getAttachment(WeldConfiguration.ATTACHMENT_KEY).isNonPortableMode(); final ExternalConfiguration configuration = new ExternalConfigurationBuilder() .add(ConfigurationKey.NON_PORTABLE_MODE.get(), nonPortableMode) .add(ConfigurationKey.ALLOW_OPTIMIZED_CLEANUP.get(), true) .build(); deployment.getServices().add(ExternalConfiguration.class, configuration); }
/** * * @param key * @param requiredType * @throws IllegalStateException If the configuration property type does not match the required type */ static void checkRequiredType(ConfigurationKey key, Class<?> requiredType) { if (!key.isValidValueType(requiredType)) { throw ConfigurationLogger.LOG.configurationPropertyTypeMismatch(key.getDefaultValue().getClass(), requiredType, key.get()); } }
/** * * @param key * @param requiredType * @throws IllegalStateException If the configuration property type does not match the required type */ static void checkRequiredType(ConfigurationKey key, Class<?> requiredType) { if (!key.isValidValueType(requiredType)) { throw ConfigurationLogger.LOG.configurationPropertyTypeMismatch(key.getDefaultValue().getClass(), requiredType, key.get()); } }
/** * * @param key * @param requiredType * @throws IllegalStateException If the configuration property type does not match the required type */ static void checkRequiredType(ConfigurationKey key, Class<?> requiredType) { if (!key.isValidValueType(requiredType)) { throw ConfigurationLogger.LOG.configurationPropertyTypeMismatch(key.getDefaultValue().getClass(), requiredType, key.get()); } }
/** * * @param key * @param requiredType * @throws IllegalStateException If the configuration property type does not match the required type */ static void checkRequiredType(ConfigurationKey key, Class<?> requiredType) { if (!key.isValidValueType(requiredType)) { throw ConfigurationLogger.LOG.configurationPropertyTypeMismatch(key.getDefaultValue().getClass(), requiredType, key.get()); } }
@SuppressWarnings("unchecked") private <T> T initSystemProperty(ConfigurationKey key, Class<T> requiredType) { checkRequiredType(key, requiredType); String property = getSystemProperty(key.get()); return (T) (property != null ? key.convertValue(property) : key.getDefaultValue()); }
@SuppressWarnings("unchecked") private <T> T initSystemProperty(ConfigurationKey key, Class<T> requiredType) { checkRequiredType(key, requiredType); String property = getSystemProperty(key.get()); return (T) (property != null ? key.convertValue(property) : key.getDefaultValue()); }
@SuppressWarnings("unchecked") private <T> T initSystemProperty(ConfigurationKey key, Class<T> requiredType) { checkRequiredType(key, requiredType); String property = getSystemProperty(key.get()); return (T) (property != null ? key.convertValue(property) : key.getDefaultValue()); }
/** * * @param from * @return the key with the given value, or <code>null</code> if no such exists */ public static ConfigurationKey fromString(String from) { for (ConfigurationKey key : values()) { if (key.get().equals(from)) { return key; } } return null; }
@SuppressWarnings("unchecked") private <T> T initSystemProperty(ConfigurationKey key, Class<T> requiredType) { checkRequiredType(key, requiredType); String property = getSystemProperty(key.get()); return (T) (property != null ? key.convertValue(property) : key.getDefaultValue()); }
/** * * @return a default {@link Weld} builder used to configure the Weld container */ public static Weld createDefaultWeld() { return new Weld().property(ConfigurationKey.CONCURRENT_DEPLOYMENT.get(), false); }
@SuppressWarnings("unchecked") private <T> T initSystemProperty(ConfigurationKey key, Class<T> requiredType) { checkRequiredType(key, requiredType); String property = getSystemProperty(key.get()); return (T) (property != null ? key.convertValue(property) : key.getDefaultValue()); }
/** * The returned {@link Weld} instance has: * <ul> * <li>automatic discovery disabled</li> * <li>concurrent deployment disabled</li> * </ul> * * @return a new {@link Weld} instance suitable for testing */ public static Weld createWeld() { return new Weld().disableDiscovery().property(ConfigurationKey.CONCURRENT_DEPLOYMENT.get(), false); }
@SuppressWarnings("unchecked") private <T> T initSystemProperty(ConfigurationKey key, Class<T> requiredType) { checkRequiredType(key, requiredType); String property = getSystemProperty(key.get()); return (T) (property != null ? key.convertValue(property) : key.getDefaultValue()); }
/** * The returned {@link Weld} instance has: * <ul> * <li>automatic discovery disabled</li> * <li>concurrent deployment disabled</li> * </ul> * * @return a new {@link Weld} instance suitable for testing */ public static Weld createWeld() { return new Weld().disableDiscovery().property(ConfigurationKey.CONCURRENT_DEPLOYMENT.get(), false); }