List of usage examples for org.apache.shiro.util Assert isTrue
public static void isTrue(boolean expression, String message)
IllegalArgumentException if the test result is false. From source file:org.springframework.data.gemfire.config.annotation.ClusterDefinedRegionsConfiguration.java
License:Apache License
@Bean public GemfireDataSourcePostProcessor gemfireDataSourcePostProcessor(GemFireCache gemfireCache) { Assert.isTrue(CacheUtils.isClient(gemfireCache), "GemFireCache must be an instance of ClientCache"); return new GemfireDataSourcePostProcessor((ClientCache) gemfireCache).using(resolveClientRegionShortcut()); }
From source file:org.springframework.data.gemfire.support.WiringDeclarableSupport.java
License:Apache License
/** * Constructs a new, initialized instance of {@link BeanConfigurerSupport} configured with * the given Spring {@link BeanFactory} and name of a Spring bean defined in the Spring {@link BeanFactory} * used as a template to wire this {@link Declarable} object. * * @param beanFactory reference to the Spring {@link BeanFactory}. * @param templateBeanName {@link String} containing the name of a Spring bean in the Spring {@link BeanFactory} * used as a template to wire this {@link Declarable} object. * @return a new, initialized instance of {@link BeanConfigurerSupport} configured with * the given Spring {@link BeanFactory}. * @see org.springframework.beans.factory.wiring.BeanConfigurerSupport * @see org.springframework.beans.factory.BeanFactory *///ww w. j a v a2 s .c om protected BeanConfigurerSupport newBeanConfigurer(BeanFactory beanFactory, String templateBeanName) { BeanConfigurerSupport beanConfigurer = new BeanConfigurerSupport(); beanConfigurer.setBeanFactory(beanFactory); if (StringUtils.hasText(templateBeanName)) { Assert.isTrue(beanFactory.containsBean(templateBeanName), String.format("Cannot find bean with name [%s]", templateBeanName)); beanConfigurer.setBeanWiringInfoResolver(beanInstance -> new BeanWiringInfo(templateBeanName)); } beanConfigurer.afterPropertiesSet(); return beanConfigurer; }
From source file:org.springframework.geode.boot.autoconfigure.condition.OnMissingPropertyCondition.java
License:Apache License
private String[] getNames(AnnotationAttributes annotationAttributes) { String[] names = annotationAttributes.getStringArray("name"); String[] values = annotationAttributes.getStringArray("value"); Assert.isTrue(names.length > 0 || values.length > 0, String.format("The name or value attribute of @%s is required", ConditionalOnMissingProperty.class.getSimpleName())); // TODO remove; not needed when using @AliasFor. /*// w w w . j a v a2s . c om Assert.isTrue(names.length * values.length == 0, String.format("The name and value attributes of @%s are exclusive", ConditionalOnMissingProperty.class.getSimpleName())); */ return names.length > 0 ? names : values; }
From source file:org.springframework.geode.config.annotation.DistributedSystemIdConfiguration.java
License:Apache License
private int validateDistributedSystemId(int distributedSystemId) { Assert.isTrue(distributedSystemId >= -1 && distributedSystemId < 256, String.format("Distributed System ID [%d] must be between -1 and 255", distributedSystemId)); return distributedSystemId; }