List of usage examples for org.springframework.util Assert hasText
public static void hasText(@Nullable String text, Supplier<String> messageSupplier)
From source file:example.app.model.Contact.java
public static Contact newContact(Person person, Address address, String email, PhoneNumber phoneNumber) { Assert.notNull(person, "Person is required"); Assert.notNull(address, "Address is required"); Assert.hasText(email, "Email is required"); Assert.notNull(phoneNumber, "PhoneNumber is required"); Contact contact = new Contact(); contact.setPerson(person);//from www . j a v a 2s . c o m contact.setAddress(address); contact.setEmail(email); contact.setPhoneNumber(phoneNumber); return contact; }
From source file:com.kuprowski.redis.security.core.session.RedisSessionRegistry.java
@Override public void registerNewSession(String sessionId, Object principal) { Assert.hasText(sessionId, "SessionId required as per interface contract"); Assert.notNull(principal, "Principal required as per interface contract"); if (logger.isDebugEnabled()) { logger.debug("Registering session " + sessionId + ", for principal " + principal); }/* w w w . j a v a 2 s . co m*/ if (getSessionInformation(sessionId) != null) { removeSessionInformation(sessionId); } sessionIdsTemplate.opsForValue().set(buildSessionIdsKey(sessionId), new SessionInformation(principal, sessionId, new Date())); principalsTemplate.opsForSet().add(buildPrincipalKey(principal), sessionId); }
From source file:com.azaptree.services.eventbus.impl.EventBusServiceImpl.java
public void init(final String eventBusName, final Executor executor) { if (eventBus != null) { log.debug("eventBus has already been created"); return;//from w ww . ja v a 2 s . co m } Assert.hasText(eventBusName, "eventBusName is required"); this.eventBusName = eventBusName; if (executor != null) { eventBus = new AsyncEventBus(eventBusName, executor); } else { eventBus = new EventBus(eventBusName); } eventBus.register(this); log.info("Created EventBus: {} -> {}", beanName, eventBus.getClass().getName()); }
From source file:fr.mby.portal.coreimpl.configuration.PropertiesConfigurationManager.java
@Override public Class<?> getConfigurationValueType(final String key) throws IllegalArgumentException { Assert.hasText(key, "No key provided !"); final Class<?> valueType = this.valueTypeByKey.get(key); if (valueType == null) { throw new IllegalArgumentException("No configuration element found for key: " + key + " !"); }// w w w . j a v a 2 s. c om return valueType; }
From source file:org.springframework.batch.item.excel.transform.DefaultRowTokenizer.java
public void afterPropertiesSet() throws Exception { if (this.includeSheetName && this.useColumnHeader) { Assert.hasText(this.attributeForSheetName, "When using column header as attributes and including the sheetname an attribute name for the sheetname is required."); }/*from www .j av a2 s.co m*/ }
From source file:org.esco.portlet.changeetab.service.impl.BasicUserInfoService.java
@Override public void afterPropertiesSet() throws Exception { Assert.hasText(this.etabCodesInfoKey, "No Etab Ids user info key configured !"); Assert.hasText(this.currentEtabCodeInfoKey, "No Current Etab Id user info key configured !"); this.basicUserInfoMap.put(this.etabCodesInfoKey, Arrays.asList(new String[] { "0450822x", "0333333y", "0377777U" })); this.basicUserInfoMap.put(this.currentEtabCodeInfoKey, Arrays.asList(new String[] { "0450822X" })); this.emptyUserInfoMap.put(this.etabCodesInfoKey, Arrays.asList(new String[] { "1234567b" })); this.emptyUserInfoMap.put(this.currentEtabCodeInfoKey, Arrays.asList(new String[] { "1234567B" })); }
From source file:grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.java
@Override public void afterPropertiesSet() throws ServletException { super.afterPropertiesSet(); Assert.notNull(authenticationDetailsSource, "authenticationDetailsSource must be set"); Assert.hasText(key, "key must be set"); }
From source file:com.azaptree.services.security.dao.HashServiceConfigurationDAO.java
@Override public HashServiceConfiguration findByName(final String name) { Assert.hasText(name, "name is required"); final Object[] args = { name }; try {// ww w . ja va 2 s . c om return jdbc.queryForObject("select * from t_hash_service_config where name = ?", args, rowMapper); } catch (final IncorrectResultSizeDataAccessException e) { return null; } }
From source file:org.activiti.spring.components.aop.ProcessStartingMethodInterceptor.java
public Object invoke(MethodInvocation invocation) throws Throwable { Method method = invocation.getMethod(); StartProcess startProcess = AnnotationUtils.getAnnotation(method, StartProcess.class); String processKey = startProcess.processKey(); Assert.hasText(processKey, "you must provide the name of process to start"); Object result;/*from w w w. ja va 2 s. co m*/ try { result = invocation.proceed(); Map<String, Object> vars = this.processVariablesFromAnnotations(invocation); String businessKey = this.processBusinessKey(invocation); log.info("variables for the started process: {}", vars.toString()); RuntimeService runtimeService = this.processEngine.getRuntimeService(); ProcessInstance pi; if (null != businessKey && StringUtils.hasText(businessKey)) { pi = runtimeService.startProcessInstanceByKey(processKey, businessKey, vars); log.info("the business key for the started process is '{}'", businessKey); } else { pi = runtimeService.startProcessInstanceByKey(processKey, vars); } String pId = pi.getId(); if (invocation.getMethod().getReturnType().equals(void.class)) return null; if (shouldReturnProcessInstance(startProcess, invocation, result)) return pi; if (shouldReturnProcessInstanceId(startProcess, invocation, result)) return pId; if (shouldReturnAsyncResultWithProcessInstance(startProcess, invocation, result)) { return new AsyncResult<ProcessInstance>(pi); } } catch (Throwable th) { throw new RuntimeException(th); } return result; }
From source file:com.cloud.utils.rest.HttpUriRequestBuilder.java
private void validate() { Assert.notNull(method, "HTTP Method cannot be null"); Assert.hasText(path, "target path must be defined"); Assert.isTrue(path.startsWith("/"), "targte path must start with a '/' character"); }