List of usage examples for org.springframework.util Assert hasText
public static void hasText(@Nullable String text, Supplier<String> messageSupplier)
From source file:fr.mby.portal.coreimpl.session.BasicSession.java
@Override public Object removeAttribute(final String name) throws IllegalArgumentException { Assert.hasText(name, "No property name provided !"); return this.session.remove(name); }
From source file:org.cloudfoundry.identity.uaa.authentication.AuthzAuthenticationRequest.java
public AuthzAuthenticationRequest(String username, String password, UaaAuthenticationDetails details) { Assert.hasText(username, "username cannot be empty"); Assert.hasText(password, "password cannot be empty"); HashMap<String, String> info = new HashMap<String, String>(); info.put("username", username.trim()); info.put("password", password.trim()); this.info = Collections.unmodifiableMap(info); this.details = details; }
From source file:cat.albirar.framework.dynabean.impl.DynaBeanDateEditor.java
/** * Instantiate a formatter for both, {@link Date} and {@link Calendar}. * @param pattern The pattern//from w ww .j ava 2 s. c o m * @param typeCalendar If the desired type is {@link Calendar} */ public DynaBeanDateEditor(String pattern, boolean typeCalendar) { Assert.hasText(pattern, "Should to indicate a date pattern string"); formatter = new SimpleDateFormat(pattern); this.typeCalendar = typeCalendar; }
From source file:org.springdata.ehcache.config.EhcacheLookupFactoryBean.java
@Override public void afterPropertiesSet() { Assert.notNull(cacheManager, "CacheManager property must be set"); String cacheName = StringUtils.hasText(name) ? name : beanName; Assert.hasText(cacheName, "Name property must be set or bean name must be defined"); cache = cacheManager.getCache(cacheName); if (cache != null) { logger.info("Retrieved cache [" + cacheName + "] from cacheManager"); } else {/*from w w w.j av a2 s .com*/ cache = lookupFallback(cacheManager, cacheName); } }
From source file:org.obiba.onyx.spring.ParticipantRegistryFactoryBean.java
public void validateArgs() throws IllegalArgumentException { Assert.notNull(fixedBean, "fixedBean cannot be null"); Assert.notNull(restfulBean, "restfulBean cannot be null"); Assert.hasText(participantRegistryType, "participantRegistryType must not be null or empty"); Assert.isTrue(/*from www .jav a2 s . com*/ participantRegistryType.equalsIgnoreCase(FIXED_TYPE) || participantRegistryType.equalsIgnoreCase(RESTFUL_TYPE), "participantRegistryType must contain the value [" + FIXED_TYPE + "] or [" + RESTFUL_TYPE + "]."); }
From source file:org.opencredo.esper.integration.config.xml.InboundChannelAdapterParser.java
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String channelRef = element.getAttribute("channel"); Assert.hasText(channelRef, "channel attribute must be provided"); builder.addConstructorArgReference(channelRef); Element eplElements = DomUtils.getChildElementByTagName(element, "epl"); if (eplElements != null) { builder.addConstructorArgValue(eplElements.getTextContent()); } else {//w w w . j a v a 2 s. co m builder.addConstructorArgValue(null); } Attr templateNameNode = element.getAttributeNode("template-name"); if (templateNameNode != null) { builder.addPropertyValue("templateName", templateNameNode.getTextContent()); } }
From source file:com.nebhale.cyclinglibrary.repository.RepositoryConfiguration.java
@Bean DataSource dataSource() throws URISyntaxException { String dbUrlProperty = System.getenv(DB_URL_PROPERTY_NAME); Assert.hasText(dbUrlProperty, String.format("The enviroment variable '%s' must be specified", DB_URL_PROPERTY_NAME)); URI dbUri = new URI(dbUrlProperty); String username = dbUri.getUserInfo().split(":")[0]; String password = dbUri.getUserInfo().split(":")[1]; String dbUrl = "jdbc:postgresql://" + dbUri.getHost() + ':' + dbUri.getPort() + dbUri.getPath() + "?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory"; BoneCPDataSource dataSource = new BoneCPDataSource(); dataSource.setDriverClass(Driver.class.getCanonicalName()); dataSource.setJdbcUrl(dbUrl);/*from ww w . ja v a 2 s.c o m*/ dataSource.setUsername(username); dataSource.setPassword(password); Flyway flyway = new Flyway(); flyway.setDataSource(dataSource); flyway.migrate(); return dataSource; }
From source file:com.baidu.jprotobuf.rpc.server.IDLServiceExporter.java
@Override public void afterPropertiesSet() throws Exception { Assert.notNull(getInvoker(), "property 'invoker' is null."); Assert.hasText(getServiceName(), "property 'serviceName' is blank."); if (inputIDL != null) { inputIDLStr = IOUtils.toString(inputIDL.getInputStream()); }//from ww w. j a v a 2 s.co m if (outputIDL != null) { outputIDLStr = IOUtils.toString(outputIDL.getInputStream()); } IDLProxyCreator idlProxyCreator = new IDLProxyCreator(inputIDLStr, outputIDLStr); inputIDLProxyObject = idlProxyCreator.getInputProxyObject(inputIDLObjectName); outputIDLProxyObject = idlProxyCreator.getOutputProxyObject(outputIDLObjectName); }
From source file:com.oreilly.springdata.jdbc.domain.Product.java
/** * Creates a new {@link Product} from the given name and description. * /*from ww w . j av a 2s .c o m*/ * @param name must not be {@literal null} or empty. * @param price must not be {@literal null} or less than or equal to zero. * @param description */ public Product(String name, BigDecimal price, String description) { Assert.hasText(name, "Name must not be null or empty!"); Assert.isTrue(BigDecimal.ZERO.compareTo(price) < 0, "Price must be greater than zero!"); this.name = name; this.price = price; this.description = description; }