45
45
public class Repositories implements Iterable <Class <?>> {
46
46
47
47
static final Repositories NONE = new Repositories ();
48
+
48
49
private static final RepositoryFactoryInformation <Object , Serializable > EMPTY_REPOSITORY_FACTORY_INFO = EmptyRepositoryFactoryInformation .INSTANCE ;
50
+ private static final String DOMAIN_TYPE_MUST_NOT_BE_NULL = "Domain type must not be null!" ;
49
51
50
52
private final BeanFactory beanFactory ;
51
53
private final Map <Class <?>, String > repositoryBeanNames ;
@@ -102,7 +104,7 @@ private void populateRepositoryFactoryInformation(ListableBeanFactory factory) {
102
104
*/
103
105
public boolean hasRepositoryFor (Class <?> domainClass ) {
104
106
105
- Assert .notNull (domainClass , "Domain class must not be null!" );
107
+ Assert .notNull (domainClass , DOMAIN_TYPE_MUST_NOT_BE_NULL );
106
108
107
109
return repositoryFactoryInfos .containsKey (domainClass );
108
110
}
@@ -115,7 +117,7 @@ public boolean hasRepositoryFor(Class<?> domainClass) {
115
117
*/
116
118
public Object getRepositoryFor (Class <?> domainClass ) {
117
119
118
- Assert .notNull (domainClass , "Domain class must not be null!" );
120
+ Assert .notNull (domainClass , DOMAIN_TYPE_MUST_NOT_BE_NULL );
119
121
120
122
String repositoryBeanName = repositoryBeanNames .get (domainClass );
121
123
return repositoryBeanName == null || beanFactory == null ? null : beanFactory .getBean (repositoryBeanName );
@@ -131,7 +133,7 @@ public Object getRepositoryFor(Class<?> domainClass) {
131
133
*/
132
134
private RepositoryFactoryInformation <Object , Serializable > getRepositoryFactoryInfoFor (Class <?> domainClass ) {
133
135
134
- Assert .notNull (domainClass , "Domain class must not be null!" );
136
+ Assert .notNull (domainClass , DOMAIN_TYPE_MUST_NOT_BE_NULL );
135
137
136
138
RepositoryFactoryInformation <Object , Serializable > repositoryInfo = repositoryFactoryInfos .get (ClassUtils
137
139
.getUserClass (domainClass ));
@@ -147,7 +149,7 @@ private RepositoryFactoryInformation<Object, Serializable> getRepositoryFactoryI
147
149
@ SuppressWarnings ("unchecked" )
148
150
public <T , S extends Serializable > EntityInformation <T , S > getEntityInformationFor (Class <?> domainClass ) {
149
151
150
- Assert .notNull (domainClass , "Domain class must not be null!" );
152
+ Assert .notNull (domainClass , DOMAIN_TYPE_MUST_NOT_BE_NULL );
151
153
152
154
return (EntityInformation <T , S >) getRepositoryFactoryInfoFor (domainClass ).getEntityInformation ();
153
155
}
@@ -161,7 +163,7 @@ public <T, S extends Serializable> EntityInformation<T, S> getEntityInformationF
161
163
*/
162
164
public RepositoryInformation getRepositoryInformationFor (Class <?> domainClass ) {
163
165
164
- Assert .notNull (domainClass , "Domain class must not be null!" );
166
+ Assert .notNull (domainClass , DOMAIN_TYPE_MUST_NOT_BE_NULL );
165
167
166
168
RepositoryFactoryInformation <Object , Serializable > information = getRepositoryFactoryInfoFor (domainClass );
167
169
return information == EMPTY_REPOSITORY_FACTORY_INFO ? null : information .getRepositoryInformation ();
@@ -177,7 +179,7 @@ public RepositoryInformation getRepositoryInformationFor(Class<?> domainClass) {
177
179
*/
178
180
public PersistentEntity <?, ?> getPersistentEntity (Class <?> domainClass ) {
179
181
180
- Assert .notNull (domainClass , "Domain class must not be null!" );
182
+ Assert .notNull (domainClass , DOMAIN_TYPE_MUST_NOT_BE_NULL );
181
183
return getRepositoryFactoryInfoFor (domainClass ).getPersistentEntity ();
182
184
}
183
185
@@ -189,7 +191,7 @@ public RepositoryInformation getRepositoryInformationFor(Class<?> domainClass) {
189
191
*/
190
192
public List <QueryMethod > getQueryMethodsFor (Class <?> domainClass ) {
191
193
192
- Assert .notNull (domainClass , "Domain class must not be null!" );
194
+ Assert .notNull (domainClass , DOMAIN_TYPE_MUST_NOT_BE_NULL );
193
195
return getRepositoryFactoryInfoFor (domainClass ).getQueryMethods ();
194
196
}
195
197
0 commit comments