List of usage examples for org.springframework.util Assert hasLength
public static void hasLength(@Nullable String text, Supplier<String> messageSupplier)
From source file:org.esupportail.portlet.filemanager.services.evaluators.UserRoleEvaluator.java
/** * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() */// w ww .j a v a 2s . co m public void afterPropertiesSet() throws Exception { Assert.hasLength(group, "The group to compare must be set !"); }
From source file:org.kmnet.com.fw.common.codelist.NumberRangeCodeList.java
/** * Initializes the codelist with the range of numbers.<br> * <p>/*w ww . j a v a 2 s. c o m*/ * <code>to</code> must be more than <code>from</code>. * </p> * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() * @throws IllegalArgumentException when if from is greater than to. */ @Override public void afterPropertiesSet() { Assert.isTrue(interval > 0, "interval should be greater than 0"); Assert.hasLength(valueFormat, "valueFormat must not be empty"); Assert.hasLength(labelFormat, "labelFormat must not be empty"); LinkedHashMap<String, String> numbers = new LinkedHashMap<String, String>(); if (from <= to) { for (int i = from; i <= to; i = i + interval) { putInMap(numbers, i); } } else { for (int i = from; i >= to; i = i - interval) { putInMap(numbers, i); } } map = Collections.unmodifiableMap(numbers); }
From source file:org.ualerts.fixed.service.commands.UpdateFixtureCommand.java
/** * {@inheritDoc}/*from ww w. j a va 2 s . c o m*/ */ @Override protected void onValidate() throws Exception { super.onValidate(); Assert.notNull(id, "id is required"); Assert.hasLength(roomNumber, "roomNumber is required"); Assert.hasLength(buildingName, "buildingName is required"); Assert.hasLength(positionHint, "positionHint is required"); Assert.notNull(inetAddress); }
From source file:com.wavemaker.commons.io.store.StoredResource.java
@Override public Resource rename(String name) throws ResourceExistsException { Assert.hasLength(name, "Name must not be empty"); Assert.isTrue(!name.contains("/"), "Name must not contain path elements"); ensureExists();//from ww w. j a v a 2 s .c o m Assert.state(getPath().getPath().getParent() != null, "Root folders cannot be renamed"); return getStore().rename(name); }
From source file:io.jmnarloch.spring.cloud.zuul.trie.AbstractTrie.java
/** * {@inheritDoc}//from w ww . j a v a 2s .c om */ @Override public T prefix(String key) { Assert.hasLength(key, "Key must be not null or not empty string."); return prefix(getRoot(), key); }
From source file:com.wavemaker.commons.io.store.StoredFolder.java
@Override public boolean hasExisting(String name) { Assert.hasLength(name, "Name must not be empty"); JailedResourcePath resourcePath = getPath().get(name); Resource existing = getStore().getExisting(resourcePath); return existing != null; }
From source file:com.mastercard.test.spring.security.WithUserDetailsSecurityContextFactory.java
public SecurityContext createSecurityContext(WithUserDetails withUser) { String beanName = withUser.userDetailsServiceBeanName(); UserDetailsService userDetailsService = StringUtils.hasLength(beanName) ? this.beans.getBean(beanName, UserDetailsService.class) : this.beans.getBean(UserDetailsService.class); String username = withUser.value(); Assert.hasLength(username, "value() must be non empty String"); UserDetails principal = userDetailsService.loadUserByUsername(username); Authentication authentication = new UsernamePasswordAuthenticationToken(principal, principal.getPassword(), principal.getAuthorities()); SecurityContext context = SecurityContextHolder.createEmptyContext(); context.setAuthentication(authentication); return context; }
From source file:com.axis.common.MockMultipartFile.java
/** * Create a new MockMultipartFile with the given content. * @param name the name of the file/*from w w w . j a v a2s. co m*/ * @param originalFilename the original filename (as on the client's machine) * @param contentType the content type (if known) * @param content the content of the file */ public MockMultipartFile(String name, String originalFilename, String contentType, byte[] content) { Assert.hasLength(name, "Name must not be null"); this.name = name; this.originalFilename = (originalFilename != null ? originalFilename : ""); this.contentType = contentType; this.content = (content != null ? content : new byte[0]); }
From source file:org.ualerts.fixed.service.commands.AddFixtureCommand.java
/** * {@inheritDoc}//from w ww . j a v a2s. c o m */ @Override protected void onValidate() throws Exception { super.onValidate(); Assert.hasLength(roomNumber, "roomNumber is required"); Assert.hasLength(buildingId, "buildingId is required"); Assert.hasLength(positionHint, "positionHint is required"); Assert.notNull(inetAddress, "inetAddress is required"); Assert.hasLength(serialNumber, "serialNumber is required"); Assert.notNull(macAddress, "macAddress is required"); }
From source file:io.jmnarloch.spring.cloud.zuul.trie.AbstractTrie.java
@Override public T remove(String key) { Assert.hasLength(key, "Key must be not null or not empty string."); return remove(getRoot(), key); }