Revisit Assert to avoid single-arg assert methods (with refined messages)

Issue: SPR-15196
(cherry picked from commit 1b2dc36)
This commit is contained in:
Juergen Hoeller
2017-01-30 22:15:53 +01:00
parent b386be1529
commit 28849e0987
85 changed files with 683 additions and 602 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -135,7 +135,6 @@ public abstract class AbstractEntityManagerFactoryBean implements
* @see javax.persistence.Persistence
*/
public void setPersistenceProviderClass(Class<? extends PersistenceProvider> persistenceProviderClass) {
Assert.isAssignable(PersistenceProvider.class, persistenceProviderClass);
this.persistenceProvider = BeanUtils.instantiateClass(persistenceProviderClass);
}
@@ -217,7 +216,6 @@ public abstract class AbstractEntityManagerFactoryBean implements
* @see JpaVendorAdapter#getEntityManagerFactoryInterface()
*/
public void setEntityManagerFactoryInterface(Class<? extends EntityManagerFactory> emfInterface) {
Assert.isAssignable(EntityManagerFactory.class, emfInterface);
this.entityManagerFactoryInterface = emfInterface;
}
@@ -231,7 +229,6 @@ public abstract class AbstractEntityManagerFactoryBean implements
* @see EntityManagerFactoryInfo#getEntityManagerInterface()
*/
public void setEntityManagerInterface(Class<? extends EntityManager> emInterface) {
Assert.isAssignable(EntityManager.class, emInterface);
this.entityManagerInterface = emInterface;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -68,7 +68,6 @@ public class SharedEntityManagerBean extends EntityManagerFactoryAccessor
*/
public void setEntityManagerInterface(Class<? extends EntityManager> entityManagerInterface) {
Assert.notNull(entityManagerInterface, "'entityManagerInterface' must not be null");
Assert.isAssignable(EntityManager.class, entityManagerInterface);
this.entityManagerInterface = entityManagerInterface;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -122,7 +122,7 @@ public class HibernateJpaDialect extends DefaultJpaDialect {
}
}
// Check that it is the Hibernate FlushMode type, not JPA's...
Assert.state(FlushMode.class == getFlushMode.getReturnType());
Assert.state(FlushMode.class == getFlushMode.getReturnType(), "Could not find Hibernate getFlushMode method");
}