List of usage examples for org.springframework.util Assert hasLength
public static void hasLength(@Nullable String text, Supplier<String> messageSupplier)
From source file:com.buaa.lzy.data.jpa.service.HotelServiceImpl.java
@Override public Hotel getHotel(City city, String name) { Assert.notNull(city, "City must not be null"); Assert.hasLength(name, "Name must not be empty"); return this.hotelRepository.findByCityAndName(city, name); }
From source file:io.jmnarloch.spring.cloud.zuul.trie.AbstractTrie.java
/** * {@inheritDoc}//from ww w . ja v a 2s . c om */ @Override public T put(String key, T value) { Assert.hasLength(key, "Key must be not null or not empty string."); return put(getRoot(), key, value); }
From source file:org.vbossica.azurebox.blob.CloudBlobContainerFactoryBean.java
@Override public void afterPropertiesSet() throws Exception { Assert.notNull(blobClient, "blobClient must be set!"); Assert.hasLength(address, "address must be set!"); }
From source file:com.wavemaker.commons.io.ClassPathFile.java
/** * Create a new {@link ClassPathFile} instance. * //from w w w . jav a2 s. co m * @param sourceClass the source class used to load the resource * @param path the path of the resource (relative to the sourceClass) */ public ClassPathFile(Class<?> sourceClass, String path) { Assert.notNull(sourceClass, "SourceClass must not be null"); Assert.hasLength(path, "Name must not be empty"); this.classLoader = sourceClass.getClassLoader(); this.path = new ResourcePath().get(sourceClass.getPackage().getName().replace(".", "/")).get(path); }
From source file:org.jasig.cas.authentication.handler.AuthenticationException.java
/** * @param type The type of the error message that caused the exception to be thrown. By default, * all errors are considered of <code>error</code>. * @param code the exception code//from ww w.j a va 2 s .c om * @param msg the error message */ public AuthenticationException(final String code, final String msg, final String type) { this(code, msg); Assert.hasLength(type, "The exception type cannot be blank"); this.type = type; }
From source file:io.jmnarloch.spring.cloud.zuul.trie.AbstractTrie.java
/** * {@inheritDoc}/* w w w.j av a 2 s . c o m*/ */ @Override public boolean containsKey(String key) { Assert.hasLength(key, "Key must be not null or not empty string."); return get(key) != null; }
From source file:com.wavemaker.commons.io.store.StoredFolder.java
@Override public Resource getExisting(String name) throws ResourceDoesNotExistException { Assert.hasLength(name, "Name must not be empty"); JailedResourcePath resourcePath = getPath().get(name); Resource resource = getStore().getExisting(resourcePath); if (resource == null) { throw new ResourceDoesNotExistException(this, name); }//www. jav a2 s .co m return resource; }
From source file:grails.plugin.springsecurity.web.access.channel.HeaderCheckInsecureChannelProcessor.java
@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); Assert.hasLength(headerName, "Header name is required"); Assert.hasLength(headerValue, "Header value is required"); }
From source file:net.javacrumbs.springws.test.common.SchemaValidator.java
/** * Creates {@link XmlValidator} from schemas. * @param schemas//from w ww. j av a 2 s .c o m * @param schemaLanguage * @return * @throws IOException */ public XmlValidator createValidatorFromSchemas(Resource[] schemas, String schemaLanguage) throws IOException { Assert.hasLength(schemaLanguage, "schemaLanguage is required"); for (int i = 0; i < schemas.length; i++) { Assert.isTrue(schemas[i].exists(), "schema [" + schemas[i] + "] does not exist"); } if (logger.isInfoEnabled()) { logger.info("Validating using \"" + StringUtils.arrayToCommaDelimitedString(schemas) + "\""); } return XmlValidatorFactory.createValidator(schemas, schemaLanguage); }
From source file:io.jmnarloch.spring.cloud.zuul.trie.AbstractTrie.java
/** * {@inheritDoc}/*ww w. java 2s .co m*/ */ @Override public T get(String key) { Assert.hasLength(key, "Key must be not null or not empty string."); return get(getRoot(), key); }