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.alfresco.configuration.PropertyDefinitionFactoryBean.java
public void afterPropertiesSet() { Assert.hasText(localName, "'localName' must not be empty."); }
From source file:fr.acxio.tools.agia.io.ChronoFileSystemResourceFactory.java
public void afterPropertiesSet() { Assert.hasText(dateFormat, "The date format must not be empty."); }
From source file:com.excilys.ebi.spring.dbunit.test.MyEntityDao.java
@Override public MyEntity getByName(final String name) { Assert.hasText(name, "name required"); return getHibernateTemplate().execute(new HibernateCallback<MyEntity>() { @Override/*from www . jav a 2 s . com*/ public MyEntity doInHibernate(Session session) throws HibernateException { return (MyEntity) session.createQuery("from " + MyEntity.class.getName() + " where name=:name") .setString("name", name).uniqueResult(); } }); }
From source file:org.cleverbus.core.common.directcall.DirectCallHttpImpl.java
@Override public String makeCall(String callId) throws IOException { Assert.hasText(callId, "callId must not be empty"); CloseableHttpClient httpClient = HttpClients.createDefault(); try {//w ww. j av a2 s. c o m HttpGet httpGet = new HttpGet(localhostUri + RouteConstants.HTTP_URI_PREFIX + DirectCallWsRoute.SERVLET_URL + "?" + DirectCallWsRoute.CALL_ID_HEADER + "=" + callId); // Create a custom response handler ResponseHandler<String> responseHandler = new ResponseHandler<String>() { public String handleResponse(HttpResponse response) throws ClientProtocolException, IOException { int status = response.getStatusLine().getStatusCode(); if (status >= 200 && status < 300) { // successful response HttpEntity entity = response.getEntity(); return entity != null ? EntityUtils.toString(entity) : null; } else { throw new IOException(EntityUtils.toString(response.getEntity())); } } }; return httpClient.execute(httpGet, responseHandler); } finally { httpClient.close(); } }
From source file:org.intan.hotelMaestro.springdata.model.RoomType.java
@PersistenceConstructor public RoomType(String name, BigDecimal price, String description) { Assert.hasText(name, "Name must not be null or empty!"); Assert.isTrue(BigDecimal.ZERO.compareTo(price) < 0, "Price must be greater than zero!"); this.name = name; this.price = price; this.description = description; }
From source file:org.opencredo.esper.integration.config.xml.EsperChannelThroughputMonitorParser.java
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String channelRef = element.getAttribute("channel-ref"); builder.addConstructorArgReference(channelRef); String sourceId = element.getAttribute("sourceId"); Assert.hasText(sourceId, "sourceId attribute is required"); builder.addConstructorArgValue(sourceId); String timeSample = element.getAttribute("time-sample"); builder.addPropertyValue("timeSample", timeSample); }
From source file:org.cloudfoundry.identity.uaa.user.UaaUser.java
public UaaUser(String id, String username, String password, String email, List<? extends GrantedAuthority> authorities, String givenName, String familyName, Date created, Date modified) {//w ww. j a va 2 s . c o m Assert.hasText(username, "Username cannot be empty"); Assert.hasText(id, "Id cannot be null"); Assert.hasText(email, "Email is required"); this.id = id; this.username = username; this.password = password; // TODO: Canonicalize email? this.email = email; this.familyName = familyName; this.givenName = givenName; this.created = created; this.modified = modified; this.authorities = authorities; }
From source file:org.jboss.seam.spring.namespace.JndiBeanManagerLocator.java
public void setBeanManagerLocationName(String beanManagerLocationName) { Assert.notNull(beanManagerLocationName, "The BeanManager location name must not be null"); Assert.hasText(beanManagerLocationName, "The BeanManager location name must not be empty"); this.beanManagerLocationName = beanManagerLocationName; }
From source file:fr.mby.portal.coreimpl.action.BasicUserAction.java
/** Protected constructor. Use the factory. */ protected BasicUserAction(final IPortalContext portalContext, final IUserDetails userDetails, final String portalSessionId, final Map<String, Iterable<String>> properties, final Map<String, String[]> parameters, final Map<String, Object> attributes) { Assert.notNull(portalContext, "No PortalContext provided !"); Assert.notNull(userDetails, "No User Principal provided !"); Assert.hasText(portalSessionId, "No Portal Session Id provided !"); Assert.notNull(properties, "No properties provided !"); Assert.notNull(parameters, "No parameters provided !"); Assert.notNull(attributes, "No attributes provided !"); this.portalContext = portalContext; this.userDetails = userDetails; this.portalSessionId = portalSessionId; this.properties = properties; this.parameters = parameters; this.attributes = attributes; }
From source file:fr.mby.utils.spring.beans.factory.ProxywiredMethodParam.java
protected ProxywiredMethodParam(final DependencyDescriptor descriptor, final String wiredClassName) { super();//w w w . ja va2 s . co m Assert.notNull(descriptor, "No DependencyDescriptor provided !"); final MethodParameter methodParam = descriptor.getMethodParameter(); Assert.notNull(methodParam, "DependencyDescriptor provided don't describe a Method parameter !"); final String methodName = methodParam.getMethod().getName(); final String paramName = methodParam.getParameterName(); Assert.hasText(wiredClassName, "Wired class name cannot be found !"); this.buildNodePath(wiredClassName, methodName, paramName); }