Example usage for org.springframework.util StringUtils trimAllWhitespace

List of usage examples for org.springframework.util StringUtils trimAllWhitespace

Introduction

In this page you can find the example usage for org.springframework.util StringUtils trimAllWhitespace.

Prototype

public static String trimAllWhitespace(String str) 

Source Link

Document

Trim all whitespace from the given String : leading, trailing, and in between characters.

Usage

From source file:org.springframework.core.env.AbstractEnvironment.java

/**
 * Return the set of default profiles explicitly set via
 * {@link #setDefaultProfiles(String...)} or if the current set of default profiles
 * consists only of {@linkplain #getReservedDefaultProfiles() reserved default
 * profiles}, then check for the presence of the
 * {@value #DEFAULT_PROFILES_PROPERTY_NAME} property and assign its value (if any)
 * to the set of default profiles./*from   ww  w .  j a v a2  s .c om*/
 * @see #AbstractEnvironment()
 * @see #getDefaultProfiles()
 * @see #DEFAULT_PROFILES_PROPERTY_NAME
 * @see #getReservedDefaultProfiles()
 */
protected Set<String> doGetDefaultProfiles() {
    synchronized (this.defaultProfiles) {
        if (this.defaultProfiles.equals(getReservedDefaultProfiles())) {
            String profiles = getProperty(DEFAULT_PROFILES_PROPERTY_NAME);
            if (StringUtils.hasText(profiles)) {
                setDefaultProfiles(
                        StringUtils.commaDelimitedListToStringArray(StringUtils.trimAllWhitespace(profiles)));
            }
        }
        return this.defaultProfiles;
    }
}

From source file:org.springframework.data.science.pmml.analytic.PmmlAnalytic.java

/**
 * Creates a new {@link PmmlAnalytic}.//  w w w.  ja v a2 s  .  com
 * 
 * @param modelName may be {@literal null}
 * @param modelLocation must not be {@literal null}
 * @param pmmlLoader may be {@literal null}
 * @param inputMapper must not be {@literal null}
 * @param outputMapper must not be {@literal null}
 */
public PmmlAnalytic(String modelName, String modelLocation, PmmlLoader pmmlLoader,
        InputMapper<I, PmmlAnalytic<I, O>, Map<FieldName, Object>> inputMapper,
        OutputMapper<I, O, PmmlAnalytic<I, O>, Map<FieldName, Object>> outputMapper) {

    super(inputMapper, outputMapper);

    Assert.notNull(modelLocation, "modelLocation");
    Assert.notNull(pmmlLoader, "pmmlLoader");

    this.modelName = StringUtils.trimAllWhitespace(modelName);
    this.modelLocation = StringUtils.trimAllWhitespace(modelLocation);

    PMML pmml = pmmlLoader.loadPmml(this.modelLocation);

    this.pmml = pmml;
    this.pmmlEvaluator = createModelEvaluator(pmml, modelName);

    if (log.isDebugEnabled()) {
        log.debug(String.format("PmmlAnalytic created for model with modelName: %s and modelLocation: %s",
                modelName, modelLocation));
    }
}