@@ -100,7 +100,11 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
100
100
101
101
private static final String ID_MUST_NOT_BE_NULL = "The given id must not be null" ;
102
102
private static final String IDS_MUST_NOT_BE_NULL = "Ids must not be null" ;
103
+ private static final String ENTITY_MUST_NOT_BE_NULL = "Entity must not be null" ;
103
104
private static final String ENTITIES_MUST_NOT_BE_NULL = "Entities must not be null" ;
105
+ private static final String EXAMPLE_MUST_NOT_BE_NULL = "Example must not be null" ;
106
+ private static final String SPECIFICATION_MUST_NOT_BE_NULL = "Specification must not be null" ;
107
+ private static final String QUERY_FUNCTION_MUST_NOT_BE_NULL = "Query function must not be null" ;
104
108
105
109
private final JpaEntityInformation <T , ?> entityInformation ;
106
110
private final EntityManager entityManager ;
@@ -190,7 +194,7 @@ public void deleteById(ID id) {
190
194
@ SuppressWarnings ("unchecked" )
191
195
public void delete (T entity ) {
192
196
193
- Assert .notNull (entity , "Entity must not be null" );
197
+ Assert .notNull (entity , ENTITY_MUST_NOT_BE_NULL );
194
198
195
199
if (entityInformation .isNew (entity )) {
196
200
return ;
@@ -490,17 +494,17 @@ public long delete(@Nullable Specification<T> spec) {
490
494
@ Override
491
495
public <S extends T , R > R findBy (Specification <T > spec , Function <FetchableFluentQuery <S >, R > queryFunction ) {
492
496
493
- Assert .notNull (spec , "Specification must not be null" );
494
- Assert .notNull (queryFunction , "Query function must not be null" );
497
+ Assert .notNull (spec , SPECIFICATION_MUST_NOT_BE_NULL );
498
+ Assert .notNull (queryFunction , QUERY_FUNCTION_MUST_NOT_BE_NULL );
495
499
496
500
return doFindBy (spec , getDomainClass (), queryFunction );
497
501
}
498
502
499
503
private <S extends T , R > R doFindBy (Specification <T > spec , Class <T > domainClass ,
500
504
Function <FetchableFluentQuery <S >, R > queryFunction ) {
501
505
502
- Assert .notNull (spec , "Specification must not be null" );
503
- Assert .notNull (queryFunction , "Query function must not be null" );
506
+ Assert .notNull (spec , SPECIFICATION_MUST_NOT_BE_NULL );
507
+ Assert .notNull (queryFunction , QUERY_FUNCTION_MUST_NOT_BE_NULL );
504
508
505
509
ScrollQueryFactory scrollFunction = (sort , scrollPosition ) -> {
506
510
@@ -589,8 +593,8 @@ public <S extends T> Page<S> findAll(Example<S> example, Pageable pageable) {
589
593
@ Override
590
594
public <S extends T , R > R findBy (Example <S > example , Function <FetchableFluentQuery <S >, R > queryFunction ) {
591
595
592
- Assert .notNull (example , "Example must not be null" );
593
- Assert .notNull (queryFunction , "Query function must not be null" );
596
+ Assert .notNull (example , EXAMPLE_MUST_NOT_BE_NULL );
597
+ Assert .notNull (queryFunction , QUERY_FUNCTION_MUST_NOT_BE_NULL );
594
598
595
599
ExampleSpecification <S > spec = new ExampleSpecification <>(example , escapeCharacter );
596
600
Class <S > probeType = example .getProbeType ();
@@ -617,7 +621,7 @@ public long count(@Nullable Specification<T> spec) {
617
621
@ Transactional
618
622
public <S extends T > S save (S entity ) {
619
623
620
- Assert .notNull (entity , "Entity must not be null" );
624
+ Assert .notNull (entity , ENTITY_MUST_NOT_BE_NULL );
621
625
622
626
if (entityInformation .isNew (entity )) {
623
627
entityManager .persist (entity );
@@ -990,7 +994,7 @@ private static class ExampleSpecification<T> implements Specification<T> {
990
994
*/
991
995
ExampleSpecification (Example <T > example , EscapeCharacter escapeCharacter ) {
992
996
993
- Assert .notNull (example , "Example must not be null" );
997
+ Assert .notNull (example , EXAMPLE_MUST_NOT_BE_NULL );
994
998
Assert .notNull (escapeCharacter , "EscapeCharacter must not be null" );
995
999
996
1000
this .example = example ;
0 commit comments