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:com.github.ukase.config.WebConfig.java

private String getProjectRootRequired() {
    Assert.state(settings.getProjectRoot() != null, "Please set \"ukase.project.root\" in application.yml");
    return settings.getProjectRoot();
}

From source file:org.cloudfoundry.identity.uaa.client.ClientAuthenticationFilter.java

@Override
public void afterPropertiesSet() {
    Assert.state(principalSource != null, "User info source must be provided");
    super.afterPropertiesSet();
    try {//from  w ww .j a  v a2 s  . com
        oauth2Available = ClassUtils.isPresent(AccessTokenRequiredException.class.getName(),
                ClassUtils.getDefaultClassLoader());
    } catch (NoClassDefFoundError e) {
        // ignore
    }
    try {
        oauthAvailable = ClassUtils.isPresent(
                org.springframework.security.oauth.consumer.AccessTokenRequiredException.class.getName(),
                ClassUtils.getDefaultClassLoader());
    } catch (NoClassDefFoundError e) {
        // ignore
    }
}

From source file:org.spring.data.gemfire.app.dao.provider.HibernateUserDao.java

@PostConstruct
public void init() {
    Assert.state(sessionFactory != null,
            "A reference to the Hibernate SessionFactory was not properly configured!");
    System.out.printf("Hibernate configuration settings (%1$s)%n", sessionFactoryBean.getConfiguration());
    System.out.printf("%1$s initialized!%n", getClass().getSimpleName());
}

From source file:net.community.chest.gitcloud.facade.backend.git.BackendUploadPackFactory.java

@Inject
public BackendUploadPackFactory(@Value(UPLOAD_TIMEOUT_SEC_INJECTION_VALUE) int timeoutValue) {
    Assert.state(timeoutValue > 0, "Bad timeout value: " + timeoutValue);
    uploadTimeoutValue = timeoutValue;/* w  ww .  ja v a 2s .co  m*/

    synchronized (holder) {
        Assert.state(holder.get() == null, "Double registered factory");
        holder.set(this);
    }
}

From source file:kr.okplace.job.launch.DefaultJobLoader.java

private BeanWrapperImpl createBeanWrapper(String path, int index) {
    Assert.state(index > 0, "Path must be nested, e.g. bean.value");
    String name = path.substring(0, index);
    Object bean = getJobConfiguration(name);
    Assert.notNull(bean, "No JobConfiguration exists with name=" + name);
    return new BeanWrapperImpl(bean);
}

From source file:org.opennms.ng.services.polloutagesconfig.PollOutagesConfigManager.java

/**
 * {@inheritDoc}/*  w  w w .j  a  v  a2 s  . c om*/
 */
@Override
public void afterPropertiesSet() throws DataAccessException {
    /**
     * It sucks to duplicate this first test from AbstractCastorConfigDao,
     * but we need to do so to ensure we don't get an NPE while initializing
     * programmaticStoreConfigResource (if needed).
     */
    Assert.state(getConfigResource() != null, "property configResource must be set and be non-null");

    super.afterPropertiesSet();
}

From source file:admin.service.JdbcSearchableStepExecutionDao.java

/**
 * @see JdbcJobExecutionDao#afterPropertiesSet()
 *///from   w  ww. j a v a  2  s . c om
@Override
public void afterPropertiesSet() throws Exception {

    Assert.state(dataSource != null, "DataSource must be provided");

    if (getJdbcTemplate() == null) {
        setJdbcTemplate(new JdbcTemplate(dataSource));
    }
    setStepExecutionIncrementer(new AbstractDataFieldMaxValueIncrementer() {
        @Override
        protected long getNextKey() {
            return 0;
        }
    });

    super.afterPropertiesSet();

}

From source file:com.gzj.tulip.jade.rowmapper.BeanPropertyRowMapper.java

/**
 * Create a new BeanPropertyRowMapper, accepting unpopulated properties
 * in the target bean./*from  w  w w  .  j a  v  a  2s. c om*/
 * 
 * @param mappedClass the class that each row should be mapped to
 */
public BeanPropertyRowMapper(Class<?> mappedClass, boolean checkColumns, boolean checkProperties) {
    this.mappedClass = mappedClass;
    Assert.state(this.mappedClass != null, "Mapped class was not specified");
    this.checkProperties = checkProperties;
    this.checkColumns = checkColumns;
    initialize();
}

From source file:com.gopivotal.spring.xd.module.jdbc.JdbcTasklet.java

public void afterPropertiesSet() throws Exception {
    Assert.state(jdbcTemplate != null, "A DataSource must be provided");
    Assert.state((sql != null) || (scripts != null), "A SQL query must be provided");
}

From source file:org.lanark.jsr303js.ValidationJavaScriptGenerator.java

protected void setWriter(Writer writer) {
    Assert.state(this.writer == null,
            "Attempted to set writer when one already set - is this class being used is multiple threads?");
    this.writer = writer;
}