Example usage for org.springframework.util Assert state

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

Introduction

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

Prototype

public static void state(boolean expression, Supplier<String> messageSupplier) 

Source Link

Document

Assert a boolean expression, throwing an IllegalStateException if the expression evaluates to false .

Usage

From source file:example.app.service.CustomerService.java

protected CustomerRepository getCustomerRepository() {
    Assert.state(customerRepository != null, "CustomerRepository was not properly initialized");
    return customerRepository;
}

From source file:com.wavemaker.commons.io.store.StoredResource.java

@Override
public Resource rename(String name) throws ResourceExistsException {
    Assert.hasLength(name, "Name must not be empty");
    Assert.isTrue(!name.contains("/"), "Name must not contain path elements");
    ensureExists();// ww w  .  ja va 2  s  .c om
    Assert.state(getPath().getPath().getParent() != null, "Root folders cannot be renamed");
    return getStore().rename(name);
}

From source file:org.glycoinfo.rdf.glycan.wurcs.GlycoSequenceResourceEntryContributorSelectSparql.java

@Override
public void afterPropertiesSet() throws Exception {
    Assert.state(getPrefix() != null, "A prefix is required");
    Assert.state(getSelect() != null, "A select is required");
}

From source file:org.appverse.web.framework.backend.security.oauth2.resourceserver.handlers.OAuth2LogoutHandler.java

public OAuth2LogoutHandler(TokenStore tokenStore) {
    Assert.state(tokenStore != null, "TokenStore cannot be null in OAuth2LogoutHandler");
    this.tokenStore = tokenStore;
}

From source file:io.tiny.mybatis.MybatisAutoConfiguration.java

@PostConstruct
public void checkConfigFileExists() {
    if (this.properties.isCheckConfigLocation()) {
        Resource resource = this.resourceLoader.getResource(this.properties.getConfig());
        Assert.state(resource.exists(), "Cannot find config location: " + resource
                + " (please add config file or check your Mybatis " + "configuration)");
    }/*from  w  ww .ja  va 2s.  c o  m*/
}

From source file:org.spring.data.gemfire.cache.execute.ProgrammerFunctions.java

protected ProgrammerRepository getProgrammerRepository() {
    Assert.state(programmerRepository != null, "'programmerRepository' was not properly initialized");
    return programmerRepository;
}

From source file:org.pivotal.sqlfire.SqlFireTransactionalBatchInsertsTest.java

@Override
protected UserService getUserService() {
    Assert.state(userService != null, "A reference to a UserService object was not properly configured!");
    return userService;
}

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

@Override
public void afterPropertiesSet() throws Exception {
    Assert.hasText(this.userDn, "No user dn configured !");
    Assert.hasText(this.userIdTemplate, "No user Id template configured !");
    Assert.hasText(this.currentEtabIdLdapKey, "No current etab Id Ldap key configured !");

    Assert.state(this.userDn.contains(this.userIdTemplate), "User dn doesn't contain the user Id template !");
}

From source file:com.netflix.spinnaker.fiat.roles.github.GithubTeamsUserRolesProvider.java

@Override
public void afterPropertiesSet() throws Exception {
    Assert.state(gitHubProperties.getOrganization() != null, "Supply an organization");
    Assert.state(gitHubProperties.getBaseUrl() != null, "Supply a base url");

    this.initializeTeamMembershipCache();
}

From source file:fr.mby.portal.coreimpl.message.AbstractMimeReply.java

@Override
public synchronized PrintWriter getWriter() throws IOException, IllegalStateException {
    Assert.state(!this.outputStreamUsed, "getOutputStream() has previously been called !");

    this.writerUsed = true;

    if (this.writer == null) {
        this.writer = new PrintWriterProxy(this.backingStream);
    }/*from   w ww.ja v  a2s .co  m*/

    return this.writer;
}