List of usage examples for org.springframework.util StringUtils delimitedListToStringArray
public static String[] delimitedListToStringArray(@Nullable String str, @Nullable String delimiter, @Nullable String charsToDelete)
From source file:com.phoenixnap.oss.ramlapisync.style.checkers.RequestBodySchemaStyleChecker.java
public RequestBodySchemaStyleChecker(String actionTypesToCheck) { String[] tokens = StringUtils.delimitedListToStringArray(actionTypesToCheck, ",", " "); for (String token : tokens) { actionsToEnforce.add(token);/*from ww w .ja va2s .c om*/ } }
From source file:com.phoenixnap.oss.ramlapisync.style.checkers.ResponseBodySchemaStyleChecker.java
public ResponseBodySchemaStyleChecker(String actionTypesToCheck) { String[] tokens = StringUtils.delimitedListToStringArray(actionTypesToCheck, ",", " "); for (String token : tokens) { actionsToEnforce.add(token);//from w w w .j av a2s. c o m } }
From source file:org.springframework.data.gemfire.support.SpringContextBootstrappingInitializer.java
/** * Initializes a Spring ApplicationContext with the given parameters specified with a GemFire <initializer> * block in cache.xml.//from w w w . ja va2s . co m * * @param parameters a Properties object containing the configuration parameters and settings defined in the * GemFire cache.xml <initializer> block for the declared SpringContextBootstrappingInitializer * GemFire Declarable object. * @throws org.springframework.context.ApplicationContextException if the Spring ApplicationContext could not be * successfully created, configured and initialized. * @see #createApplicationContext(String[], String[]) * @see #initApplicationContext(org.springframework.context.ConfigurableApplicationContext) * @see #refreshApplicationContext(org.springframework.context.ConfigurableApplicationContext) * @see java.util.Properties */ @Override public void init(final Properties parameters) { try { synchronized (SpringContextBootstrappingInitializer.class) { if (applicationContext == null || !applicationContext.isActive()) { String basePackages = parameters.getProperty(BASE_PACKAGES_PARAMETER); String contextConfigLocations = parameters.getProperty(CONTEXT_CONFIG_LOCATIONS_PARAMETER); String[] basePackagesArray = StringUtils.delimitedListToStringArray( StringUtils.trimWhitespace(basePackages), COMMA_DELIMITER, CHARS_TO_DELETE); String[] contextConfigLocationsArray = StringUtils.delimitedListToStringArray( StringUtils.trimWhitespace(contextConfigLocations), COMMA_DELIMITER, CHARS_TO_DELETE); ConfigurableApplicationContext localApplicationContext = refreshApplicationContext( initApplicationContext( createApplicationContext(basePackagesArray, contextConfigLocationsArray))); Assert.state(localApplicationContext.isRunning(), String.format( "The Spring ApplicationContext (%1$s) failed to be properly initialized with the context config files (%2$s) or base packages (%3$s)!", nullSafeGetApplicationContextId(localApplicationContext), Arrays.toString(contextConfigLocationsArray), Arrays.toString(basePackagesArray))); applicationContext = localApplicationContext; } } } catch (Throwable cause) { String message = "Failed to bootstrap the Spring ApplicationContext!"; logger.error(message, cause); throw new ApplicationContextException(message, cause); } }
From source file:ro.cs.om.common.ConfigParametersProvider.java
/** * Returns a Color value read from a config file. * The Color must be in RGB form. /*from w w w . j a v a2s . c o m*/ * @author dan.damian */ public static Color getStringAsColor(String _RESOURCE_BUNDLE, String key) { RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_ROOT.concat(_RESOURCE_BUNDLE)); Color c = null; try { String value = RESOURCE_BUNDLE.getString(key); String[] numbers = StringUtils.delimitedListToStringArray(value, ",", ")][("); int R = Integer.parseInt(numbers[0].trim()); int G = Integer.parseInt(numbers[1].trim()); int B = Integer.parseInt(numbers[2].trim()); c = new Color(R, G, B); } catch (Exception e) { logger.error(e); return null; } return c; }