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

public static void hasText(@Nullable String text, Supplier<String> messageSupplier) 

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:cz.jirutka.spring.data.jdbc.TableDescription.java

/**
 * @param tableName The table name.//from   ww w  .  j  a  v  a 2s .  c o  m
 * @throws IllegalArgumentException if {@code tableName} is blank.
 */
public void setTableName(String tableName) {
    Assert.hasText(tableName, "tableName must not be blank");
    this.tableName = tableName;
}

From source file:com.orange.clara.cloud.cf.servicebroker.log.infrastructure.SplunkDashboardUrlFactory.java

private void setLogServerUrl(String logServerUrl) {
    Assert.hasText(logServerUrl,
            "Invalid log server url <" + logServerUrl + ">. Log server url should not be empty.");
    this.logServerUrl = logServerUrl;
}

From source file:org.cleverbus.component.throttling.ThrottlingComponent.java

@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters)
        throws Exception {
    ThrottlingEndpoint endpoint = new ThrottlingEndpoint(uri, this);

    // parse URI - "requestType:operationName"
    String endpointURI = ObjectHelper.after(uri, ":");
    if (endpointURI != null && endpointURI.startsWith("//")) {
        endpointURI = endpointURI.substring(2);
    }//w w w  . j  a  v  a 2  s  . c  o  m

    endpointURI = StringUtils.trimToNull(endpointURI);
    Assert.hasText(endpointURI, "Throttling endpoint URI must not be empty");

    RequestTypeEnum requestTypeEnum;
    String requestType;
    String operationName = null;

    // endpointURI = "requestType:operationName"
    if (StringUtils.contains(endpointURI, ":")) {
        requestType = ObjectHelper.before(endpointURI, ":");
        operationName = ObjectHelper.after(endpointURI, ":");
    } else {
        requestType = endpointURI;
    }

    // check request type value
    if (requestType.equalsIgnoreCase(RequestTypeEnum.SYNC.name())
            || requestType.equalsIgnoreCase(RequestTypeEnum.ASYNC.name())) {
        requestTypeEnum = RequestTypeEnum.valueOf(requestType.toUpperCase());
    } else {
        throw new IllegalArgumentException(
                "request type must have one of the following values: 'sync' or 'async'");
    }

    // check operation name for SYNC request type
    if (requestTypeEnum == RequestTypeEnum.SYNC && operationName == null) {
        throw new IllegalArgumentException("operation name is mandatory for 'sync' request type");
    }

    endpoint.setRequestType(requestTypeEnum);
    endpoint.setOperationName(operationName);

    return endpoint;
}

From source file:fr.mby.utils.spring.beans.factory.ProxywiredField.java

public ProxywiredField(final String nodePath) {
    super();//from  ww w  .j av  a2s .  c  om

    Assert.hasText(nodePath, "No nodePath provided !");
    this.nodePath = nodePath;
}

From source file:fr.mby.utils.spring.beans.factory.ProxywiredMethodParam.java

public ProxywiredMethodParam(final Class<?> wiredClass, final String methodName, final String paramName) {
    super();/*w w w .  jav a 2s .  c  o  m*/

    Assert.notNull(wiredClass, "No Wired class provided !");
    Assert.hasText(methodName, "No Method name provided !");
    Assert.hasText(paramName, "No Parameter name provided !");

    this.buildNodePath(wiredClass.getName(), methodName, paramName);
}

From source file:com.autentia.wuija.security.impl.hibernate.HibernateGroupManager.java

/**
 * @see GroupManager#addGroupAuthority(String, GrantedAuthority)
 *///  w w w .j a v  a2s .co m
@Transactional
public void addGroupAuthority(String groupname, GrantedAuthority authority) {
    Assert.hasText(groupname, GROUPNAME_EMPTY_ERROR);
    Assert.notNull(authority, "authority cannot be null");

    final SecurityGroup group = userDetailsServiceHelper.loadGroupByGroupName(groupname);
    group.addAuthority(authority);
}

From source file:se.vgregion.urlservice.stats.piwik.DefaultPiwikClient.java

public DefaultPiwikClient(String piwikBase, String siteId) {
    Assert.hasText(piwikBase, "piwikBase must be provided");
    Assert.hasText(siteId, "siteId must be provided");

    // start the async handler
    new PiwikTrackerThread(piwikBase, siteId, hits).start();
}

From source file:org.esco.portlet.changeetab.dao.impl.EtablissementAttributesMapper.java

@Override
public Object mapFromAttributes(final Attributes attrs) throws NamingException {
    final Etablissement etab = new Etablissement();

    etab.setId((String) attrs.get(this.idAttrKey).get());
    etab.setCode(etab.getId().toLowerCase());
    etab.setName((String) attrs.get(this.nameAttrKey).get());
    etab.setDescription((String) attrs.get(this.descriptionAttrKey).get());

    Assert.hasText(etab.getId(), "No UAI attribute found in LDAP for Etablissement !");
    Assert.hasText(etab.getName(), "No Name attribute found in LDAP for Etablissement !");
    Assert.hasText(etab.getDescription(), "No Description attribute found in LDAP for Etablissement !");

    return etab;//www .j  a  v a  2 s.c  o m
}

From source file:org.juiser.spring.security.web.authentication.HeaderAuthenticationFilter.java

public HeaderAuthenticationFilter(String headerName, AuthenticationManager authenticationManager) {
    Assert.hasText(headerName, "headerName cannot be null or empty.");
    Assert.notNull("AuthenticationManager is required.");
    this.headerName = headerName;
    this.requiresAuthenticationRequestMatcher = new RequestHeaderRequestMatcher(headerName, null);
    this.authenticationManager = authenticationManager;
}

From source file:com.tealium.publisher.ftp.FtpSession.java

@Override
public boolean remove(String path) throws IOException {
    Assert.hasText(path, "path must not be null");
    try {/*from   w  w w  . ja  va2 s .c  o m*/
        this.client.deleteFile(path);
    } catch (IllegalStateException | FTPIllegalReplyException | FTPException e) {
        logger.error("remove : " + path + "-" + getError(e), e);
        throw new IOException(getError(e).toString());
    }

    return Boolean.TRUE;
}