List of usage examples for org.springframework.util Assert state
public static void state(boolean expression, Supplier<String> messageSupplier)
From source file:com.isalnikov.utils.MessageHelper.java
public String getMessage(Locale Locale, Object... params) { Assert.state(!(Objects.isNull(params) || params.length == 0 || params[0] == null || ((String) params[0]).isEmpty()), "MessageHelper getMessage -> params is null"); Object[] args = new Object[] {}; if (params.length > 1) { args = new Object[params.length - 1]; System.arraycopy(params, 1, args, 0, params.length - 1); }/*from w w w . j a v a2 s . co m*/ String result = messageSource.getMessage((String) params[0], args, Locale); return result; }
From source file:app.core.Db.java
public static Session getSession() { SessionFactory sessionFactory = getSessionFactory(); Assert.state(sessionFactory != null, "SessionFactory not injected"); // Spring TransactionSynchronizationManager keeps the current session available for us via TransactionSynchronizationManager.getResource("sessionHolder"). // Assert.isTrue(TransactionSynchronizationManager.isActualTransactionActive(), "No need to go any further if no transaction."); try {//from w w w . jav a 2 s .c o m return sessionFactory.getCurrentSession(); } catch (HibernateException e) { return sessionFactory.openSession(); } // return (Session) em().getDelegate(); }
From source file:org.kuali.maven.plugins.graph.util.Counter.java
public synchronized int increment() { Assert.state(value < Integer.MAX_VALUE, "Maximum counter value exceeded"); return value++; }
From source file:org.kuali.maven.plugins.graph.util.Counter.java
public synchronized int decrement() { Assert.state(value > Integer.MIN_VALUE, "Minimum counter value exceeded"); return value--; }
From source file:fr.mby.portal.coreimpl.BasicPortalService.java
@Override public IApp getTargetedApp(final HttpServletRequest request) { final IApp app = this.appStore.retrieveApp(request); Assert.state(app != null, "IApp should exists in the store !"); return app;//from w w w.j a v a 2 s .c om }
From source file:org.kuali.maven.plugins.graph.validate.OmittedDependencyNodeValidator.java
@Override protected void validateState(List<DependencyNode> nodes) { for (DependencyNode node : nodes) { Assert.state(node.getRelatedArtifact() != null, state + " nodes must contain related artifacts"); boolean similar = helper.similar(node.getArtifact(), node.getRelatedArtifact()); Assert.state(similar, "Artifact's must be the same except for version"); }/*from www . java2s . c o m*/ }
From source file:org.eclipse.swordfish.core.configuration.xml.XmlConfigurationSource.java
public Map<String, Map<String, String>> getConfigurations() { Assert.state(propertiesTransformer.isConfigurationLoaded(), "Configuration is not loaded"); return propertiesTransformer.getPropertiesForPids(); }
From source file:org.spring.data.gemfire.app.service.CustomerService.java
protected GemfireRegionCustomerDao getCustomerDao() { Assert.state(customerDao != null, "A reference to the GemfireRegionCustomerDao was not properly configured!"); return customerDao; }
From source file:org.cloudfoundry.identity.uaa.client.OAuth2AccessTokenSource.java
@Override public void afterPropertiesSet() { Assert.state(restTemplate != null, "RestTemplate URL must be provided"); }
From source file:com.travelport.restneohack.model.domain.AccountView.java
public AccountView withBillingAddress(Address billingAddress) { Assert.state(traveler.hasAddress(billingAddress), "valid traveler address for " + traveler); this.billingAddress = billingAddress; return this; }