List of usage examples for org.springframework.util Assert hasText
public static void hasText(@Nullable String text, Supplier<String> messageSupplier)
From source file:fr.acxio.tools.agia.item.ConditionalItemWriter.java
@Override public void afterPropertiesSet() throws Exception { Assert.hasText(condition, "Condition must be set"); Assert.notNull(delegate, "Delegate must be set"); }
From source file:org.opencredo.couchdb.core.CouchDbDocumentTemplate.java
/** * Constructs an instance of CouchDbDocumentTemplate with a default database * @param defaultDatabaseUrl the default database to connect to *//*from w w w . jav a 2 s . c o m*/ public CouchDbDocumentTemplate(String defaultDatabaseUrl) { super(defaultDatabaseUrl); Assert.hasText(defaultDatabaseUrl, "defaultDatabaseUrl must not be empty"); setDefaultDocumentUrl(defaultDatabaseUrl); }
From source file:gemfire.practice.service.DefaultCustomerService.java
/** * Create a new customer//from w w w.ja v a2s.co m * * @param customer * @return */ @Override @Profiled(tag = "createCustomer") public Customer create(Customer customer) { Assert.notNull(customer, "customer cannot be null"); Assert.notNull(customer.getId(), "customer ID cannot be null"); Assert.hasText(customer.getFirstname(), "customer first name must contain text"); Assert.hasText(customer.getLastname(), "customer last name must contain text"); Assert.notNull(customer.getEmailAddress(), "customer email address must not be null"); Customer newCustomer = customerRepository.save(customer); LOGGER.info("New customer created with id: {}, thread {} is {}", customer.getId(), Thread.currentThread().getName(), customer); return newCustomer; }
From source file:fr.mby.portal.coreimpl.app.MemoryAppStore.java
@Override public IApp retrieveApp(final HttpServletRequest request) { final String signature = this.appSigner.retrieveSignature(request); Assert.hasText(signature, "No App signature found in Http request !"); final IApp retrievedApp = this.appStore.get(signature); return retrievedApp; }
From source file:com.azaptree.services.security.impl.SecurityServiceImpl.java
@Override public HashService getHashService(final String name) throws SecurityServiceException { Assert.hasText(name, "name is required"); final HashServiceConfiguration config = hashServiceConfigurationDAO.findByName(name); if (config != null) { return config.getHashService(); }/*w ww . j a va 2 s .com*/ return null; }
From source file:us.swcraft.springframework.cache.aerospike.AerospikeCacheManager.java
public AerospikeCacheManager(String defaultNamespace, String defaultSetname, int defaultTimeToLiveInSeconds, IAerospikeClient aerospikeClient, IAsyncClient aerospikeAsyncClient, Serializer serializer) { Assert.hasText(defaultNamespace, "namespace can't be null"); Assert.hasText(defaultSetname, "default setname can't be null"); Assert.notNull(aerospikeClient, "aerospike client can't be null"); Assert.notNull(aerospikeAsyncClient, "async aerospike client can't be null"); Assert.notNull(serializer, "serializer can't be null"); this.defaultNamespace = defaultNamespace; this.defaultSetname = defaultSetname; this.defaultCacheName = this.defaultNamespace + ":" + this.defaultSetname; this.aerospikeClient = aerospikeClient; this.aerospikeAsyncClient = aerospikeAsyncClient; this.serializer = serializer; // pre-build default cache createCache(defaultCacheName, defaultTimeToLiveInSeconds); }
From source file:com.gopivotal.cla.EnvironmentVariableConfiguration.java
private String getRequiredProperty(String key) { String property = System.getenv(key); Assert.hasText(property, String.format("The enviroment variable '%s' must be specified", key)); return property; }
From source file:fr.mby.utils.spring.beans.factory.ProxywiredField.java
public ProxywiredField(final Class<?> wiredClass, final String fieldName) { super();/*from w w w. ja va2s . c o m*/ Assert.notNull(wiredClass, "No Wired class provided !"); Assert.hasText(fieldName, "No Field name provided !"); this.buildNodePath(wiredClass.getName(), fieldName); }
From source file:de.escalon.hypermedia.spring.PartialUriTemplate.java
/** * Creates a new {@link PartialUriTemplate} using the given template string. * * @param template must not be {@literal null} or empty. */// w w w . j av a 2s . c o m public PartialUriTemplate(String template) { Assert.hasText(template, "Template must not be null or empty!"); Matcher matcher = VARIABLE_REGEX.matcher(template); // first group is the variable start without leading {: "", "/", "?", "#", // second group is the comma-separated name list without the trailing } of the variable int endOfPart = 0; while (matcher.find()) { // 0 is the current match, i.e. the entire variable expression int startOfPart = matcher.start(0); // add part before current match if (endOfPart < startOfPart) { final String partWithoutVariables = template.substring(endOfPart, startOfPart); final StringTokenizer stringTokenizer = new StringTokenizer(partWithoutVariables, "?", true); boolean inQuery = false; while (stringTokenizer.hasMoreTokens()) { final String token = stringTokenizer.nextToken(); if ("?".equals(token)) { inQuery = true; } else { if (!inQuery) { urlComponents.add(token); } else { urlComponents.add("?" + token); } variableIndices.add(Collections.<Integer>emptyList()); } } } endOfPart = matcher.end(0); // add current match as part final String variablePart = template.substring(startOfPart, endOfPart); urlComponents.add(variablePart); // collect variablesInPart and track for each part which variables it contains // group(1) is the variable head without the leading { TemplateVariable.VariableType type = TemplateVariable.VariableType.from(matcher.group(1)); // group(2) is the String[] names = matcher.group(2).split(","); List<Integer> variablesInPart = new ArrayList<Integer>(); for (String name : names) { TemplateVariable variable = new TemplateVariable(name, type); variablesInPart.add(variables.size()); variables.add(variable); variableNames.add(name); } variableIndices.add(variablesInPart); } // finish off remaining part if (endOfPart < template.length()) { urlComponents.add(template.substring(endOfPart)); variableIndices.add(Collections.<Integer>emptyList()); } }
From source file:com.example.demo.domain.Customer.java
public void setName(String name) { Assert.hasText(name, "Name must not be null or empty!"); this.name = name; }