List of usage examples for org.springframework.util Assert notNull
public static void notNull(@Nullable Object object, Supplier<String> messageSupplier)
From source file:fr.mby.utils.common.jpa.AbstractOsgiJpaDao.java
@Override public void afterPropertiesSet() throws Exception { Assert.hasText(this.getPersistenceUnitName(), "Persistence Unit name not configured !"); Assert.notNull(this.bundleContext, "BundleContext was not injected !"); this.emf = OsgiJpaHelper.retrieveEmfByName(this.bundleContext, this.getPersistenceUnitName()); Assert.notNull(this.emf, "Cannot retrieve the EntityManageFactory !"); }
From source file:com.jaxio.celerio.output.FileMetaData.java
/** * @param pack/*from www.ja v a 2s . c o m*/ * @param template * @param fileRelativePath relative to the project dir. That is the dir containing ".celerio/generated.xml" * @param file */ public FileMetaData(TemplatePack pack, Template template, String fileRelativePath, File file) { Assert.notNull(fileRelativePath, "When creating a new FileMetaData, you must pass a relativePath as it is used in equals comparison"); Assert.isTrue(file.exists(), "When creating a new FileMetaData, you must be sure that the passed file exists."); this.pack = pack == null ? "" : pack.getName(); this.template = template == null ? "" : template.getName(); this.size = file.length(); this.path = fileRelativePath; this.lastMod = file.lastModified(); }
From source file:io.jmnarloch.spring.boot.rxjava.async.SingleDeferredResult.java
public SingleDeferredResult(Long timeout, Object timeoutResult, Single<T> single) { super(timeout, timeoutResult); Assert.notNull(single, "single can not be null"); subscriber = new DeferredResultSubscriber<T>(single.toObservable(), this); }
From source file:ch.ralscha.extdirectspring.util.JsonHandler.java
/** * Sets a new instance of {@link ObjectMapper}. * * @param mapper a new object mapper. must not be <code>null</code> *//*from w w w . j a va 2s . c o m*/ public void setMapper(ObjectMapper mapper) { Assert.notNull(mapper, "ObjectMapper must not be null"); this.mapper = mapper; }
From source file:gemfire.practice.domain.LineItem.java
/** * Creates a new {@link LineItem} for the given {@link Product} and amount. * //from ww w .j a va 2 s . com * @param product must not be {@literal null}. * @param amount */ public LineItem(Product product, int amount) { Assert.notNull(product, "The given Product must not be null!"); Assert.isTrue(amount > 0, "The amount of Products to be bought must be greater than 0!"); productId = product.getId(); this.amount = amount; price = product.getPrice(); }
From source file:example.app.model.Address.java
public static Address newAddress(String street, String city, State state, String zipCode) { Assert.hasText(street, "street is required"); Assert.hasText(city, "city is required"); Assert.notNull(state, "state is required"); Assert.hasText(zipCode, "zipCode is required"); Address address = new Address(); address.setStreet(street);/*from w w w .java 2 s . com*/ address.setCity(city); address.setState(state); address.setZipCode(zipCode); return address; }
From source file:com.appdynamics.cloudfoundry.appdservicebroker.catalog.Plan.java
String getName() { synchronized (this.monitor) { Assert.notNull(this.id, "Plans must specify a name"); return this.name; }//from w ww . ja v a 2s . c o m }
From source file:com.frank.search.solr.core.query.DefaultValueFunction.java
/** * Creates new {@link DefaultValueFunction} representing {@code def(function, defaultValue))} * //from w w w.j a v a 2 s . co m * @param function must not be null * @param defaultValue must not be null * @return */ public static DefaultValueFunction defaultValue(Function function, Object defaultValue) { Assert.notNull(function, "Function must not be 'null' for default value operation."); Assert.notNull(defaultValue, "DefaultValue must not be 'null'."); return new DefaultValueFunction(function, defaultValue); }