List of usage examples for org.springframework.util Assert hasText
public static void hasText(@Nullable String text, Supplier<String> messageSupplier)
From source file:com.azaptree.services.security.credentialToByteSourceConverters.StringToByteSourceConverter.java
@Override public byte[] convert(final String credential) { Assert.hasText(credential, "credential is required"); try {/*from w ww .j av a 2 s. co m*/ return credential.getBytes("UTF-8"); } catch (final UnsupportedEncodingException e) { throw new IllegalStateException(e); } }
From source file:com.orange.clara.cloud.cf.servicebroker.log.domain.SyslogDrainUrl.java
private void setValue(String value) { Assert.hasText(value, "Invalid syslog drain url <" + value + ">. Syslog drain url should not be empty."); Assert.isTrue(value.startsWith(SYSLOG_SCHEME), "Invalid syslog drain url <" + value + ">. Syslog drain url should start with " + SYSLOG_SCHEME + "."); this.value = value; }
From source file:example.springdata.cassandra.util.CassandraResource.java
CassandraResource(String host, int port) { Assert.hasText(host, "Host must not be null or empty!"); Assert.isTrue(port >= 0 && port <= 65535, "Port must be in the range of 0..65535!"); this.host = host; this.port = port; }
From source file:org.opencredo.cloud.storage.azure.AzureCredentials.java
/** * @param accountName// w w w . j av a 2s. co m * @param secretKey */ public AzureCredentials(String accountName, String secretKey) { super(); Assert.hasText("Azure account name must be specified", accountName); Assert.hasText("Azure secret key must be specified", secretKey); this.accountName = accountName; this.secretKey = secretKey; }
From source file:org.juiser.spring.security.authentication.HeaderAuthenticationToken.java
public HeaderAuthenticationToken(String headerName, String headerValue) { super(null);// ww w. java 2s . c o m Assert.hasText(headerName, "headerName cannot be null or empty."); this.headerName = headerName; Assert.hasText(headerValue, "headerValue cannot be null or empty."); this.headerValue = headerValue; }
From source file:com.myproject.axom.priceengine.api.CreateProductsCommand.java
public void setProductName(String productName) { Assert.hasText(productName, "Name for new product package must contain text"); this.productName = productName; }
From source file:org.zalando.github.spring.pagination.RelationsPredicate.java
public RelationsPredicate(String relation) { Assert.notNull(relation, "'relation' should never be null"); Assert.hasText(relation, "'relation' should never be empty"); this.relation = relation; }
From source file:com.azaptree.services.security.Credential.java
public Credential(final String name, final Object credential) { Assert.hasText(name, "name is required"); Assert.notNull(credential, "credential is required"); this.name = name; this.credential = credential; expiresOn = null;/*from w w w . j a v a 2s . c o m*/ }
From source file:example.app.model.PhoneNumber.java
public static PhoneNumber newPhoneNumber(String areaCode, String prefix, String suffix) { Assert.hasText(areaCode, "areaCode is required"); Assert.hasText(prefix, "prefix is required"); Assert.hasText(suffix, "suffix is required"); PhoneNumber phoneNumber = new PhoneNumber(); phoneNumber.setAreaCode(areaCode);/* ww w . j ava 2 s .c om*/ phoneNumber.setPrefix(prefix); phoneNumber.setSuffix(suffix); return phoneNumber; }
From source file:org.axonframework.sample.app.api.CreateContactCommand.java
/** * Set the name for the new Contact. An exception is thrown when the provided name is empty * * @param newContactName String containing the name for the new contact *//*from w w w .j av a2s .c o m*/ public void setNewContactName(String newContactName) { Assert.hasText(newContactName, "Name for new contact must contain text"); this.newContactName = newContactName; }