Example usage for org.springframework.util Assert hasText

List of usage examples for org.springframework.util Assert hasText

Introduction

In this page you can find the example usage for org.springframework.util Assert hasText.

Prototype

@Deprecated
public static void hasText(@Nullable String text) 

Source Link

Document

Assert that the given String contains valid text content; that is, it must not be null and must contain at least one non-whitespace character.

Usage

From source file:at.pagu.soldockr.core.HttpSolrServerFactory.java

public HttpSolrServerFactory(SolrServer solrServer, String core, Credentials credentials, String authPolicy) {
    Assert.notNull(solrServer, "SolrServer must not be null");
    if (authPolicy != null) {
        Assert.hasText(authPolicy);
    }//from ww  w .j ava  2 s.  com

    this.core = core;
    this.solrServer = solrServer;
    this.credentials = credentials;
    this.authPolicy = authPolicy;

    appendCoreToBaseUrl(this.core, this.solrServer);
    appendAuthentication(this.credentials, this.authPolicy, this.solrServer);
}

From source file:org.cloudfoundry.identity.uaa.login.BuildInfo.java

@Override
public void afterPropertiesSet() {
    try {//from   w w w .  jav a  2 s .  c om
        Properties gitProperties = PropertiesLoaderUtils.loadAllProperties("git.properties");
        commitId = gitProperties.getProperty("git.commit.id.abbrev", "UNKNOWN");
        String currentTime = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date());
        timestamp = gitProperties.getProperty("git.commit.time", currentTime);
    } catch (IOException e) {
        logger.debug("Exception loading git.properties", e);
    }
    try {
        Properties buildProperties = PropertiesLoaderUtils.loadAllProperties("build.properties");
        version = buildProperties.getProperty("build.version");
    } catch (IOException e) {
        logger.debug("Exception loading build.properties", e);
    }
    Assert.hasText(uaaUrl);
    Assert.hasText(version);
    Assert.hasText(commitId);
    Assert.hasText(timestamp);
}

From source file:com.miko.demo.mongo.model.EntityA.java

public EntityA(String name, Long value) {

    Assert.notNull(value);
    Assert.hasText(name);

    this.name = name;
    this.value = value;
}

From source file:com.frank.search.solr.server.support.HttpSolrClientFactory.java

public HttpSolrClientFactory(SolrClient solrClient, String core, Credentials credentials, String authPolicy) {
    super(solrClient);
    Assert.notNull(solrClient, "SolrServer must not be null");

    if (authPolicy != null) {
        Assert.hasText(authPolicy);
    }/*from   w  w  w.  j a v a 2  s  .  c  o m*/

    this.core = core;
    this.credentials = credentials;
    this.authPolicy = authPolicy;

    appendCoreToBaseUrl(this.core, this.getSolrClient());
    appendAuthentication(this.credentials, this.authPolicy, this.getSolrClient());
}

From source file:org.cloudfoundry.identity.uaa.api.user.impl.UaaUserOperationsImpl.java

public ScimUser updateUser(ScimUser user) {
    Assert.notNull(user);//from ww  w .j  a  va2 s . c  om
    Assert.hasText(user.getId());

    // don't try to update the stuff we can't update here
    if (!CollectionUtils.isEmpty(user.getGroups())) {
        user.getGroups().clear();
    }

    user.setPassword(null);

    return helper.putScimObject("/Users/{id}", user, USER_REF, user.getId());
}

From source file:com.hongqiang.shop.common.utils.FreeMarkers.java

public static void setVariable(String name, Object value, Environment env) throws TemplateModelException {
    Assert.hasText(name);
    Assert.notNull(env);/*from  w w  w. j  a va2s  .c o m*/
    if ((value instanceof TemplateModel))
        env.setVariable(name, (TemplateModel) value);
    else
        env.setVariable(name, ObjectWrapper.BEANS_WRAPPER.wrap(value));
}

From source file:org.red5.server.script.jython.JythonScriptFactory.java

@SuppressWarnings({ "rawtypes" })
public JythonScriptFactory(String scriptSourceLocator, Class[] scriptInterfaces) {
    Assert.hasText(scriptSourceLocator);
    Assert.notEmpty(scriptInterfaces);//from w w  w  .  j ava 2 s. com
    this.scriptSourceLocator = scriptSourceLocator;
    this.scriptInterfaces = scriptInterfaces;
    this.arguments = null;
}

From source file:com.scase.core.service.impl.StaticServiceImpl.java

@Transactional(readOnly = true)
public int build(String templatePath, String staticPath, Map<String, Object> model) {
    Assert.hasText(templatePath);
    Assert.hasText(staticPath);/* ww  w.j  a  va  2s . c  o  m*/

    FileOutputStream fileOutputStream = null;
    OutputStreamWriter outputStreamWriter = null;
    Writer writer = null;
    try {
        freemarker.template.Template template = freeMarkerConfigurer.getConfiguration()
                .getTemplate(templatePath);
        File staticFile = new File(servletContext.getRealPath(staticPath));
        File staticDirectory = staticFile.getParentFile();
        if (!staticDirectory.exists()) {
            staticDirectory.mkdirs();
        }
        fileOutputStream = new FileOutputStream(staticFile);
        outputStreamWriter = new OutputStreamWriter(fileOutputStream, "UTF-8");
        writer = new BufferedWriter(outputStreamWriter);
        template.process(model, writer);
        writer.flush();
        return 1;
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        IOUtils.closeQuietly(writer);
        IOUtils.closeQuietly(outputStreamWriter);
        IOUtils.closeQuietly(fileOutputStream);
    }
    return 0;
}

From source file:nl.gridshore.nosapi.impl.DataProviderImpl.java

public DataProviderImpl(String apiKey, RestTemplate restTemplate) {
    Assert.hasText(apiKey);
    Assert.notNull(restTemplate);//from w w  w.  ja  v a 2 s.c o  m
    this.restTemplate = restTemplate;
    this.apiKey = apiKey;
}