@@ -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 ;
@@ -495,17 +499,17 @@ public long delete(@Nullable Specification<T> spec) {
495
499
@ Override
496
500
public <S extends T , R > R findBy (Specification <T > spec , Function <FetchableFluentQuery <S >, R > queryFunction ) {
497
501
498
- Assert .notNull (spec , "Specification must not be null" );
499
- Assert .notNull (queryFunction , "Query function must not be null" );
502
+ Assert .notNull (spec , SPECIFICATION_MUST_NOT_BE_NULL );
503
+ Assert .notNull (queryFunction , QUERY_FUNCTION_MUST_NOT_BE_NULL );
500
504
501
505
return doFindBy (spec , getDomainClass (), queryFunction );
502
506
}
503
507
504
508
private <S extends T , R > R doFindBy (Specification <T > spec , Class <T > domainClass ,
505
509
Function <FetchableFluentQuery <S >, R > queryFunction ) {
506
510
507
- Assert .notNull (spec , "Specification must not be null" );
508
- Assert .notNull (queryFunction , "Query function must not be null" );
511
+ Assert .notNull (spec , SPECIFICATION_MUST_NOT_BE_NULL );
512
+ Assert .notNull (queryFunction , QUERY_FUNCTION_MUST_NOT_BE_NULL );
509
513
510
514
ScrollQueryFactory scrollFunction = (sort , scrollPosition ) -> {
511
515
@@ -594,8 +598,8 @@ public <S extends T> Page<S> findAll(Example<S> example, Pageable pageable) {
594
598
@ Override
595
599
public <S extends T , R > R findBy (Example <S > example , Function <FetchableFluentQuery <S >, R > queryFunction ) {
596
600
597
- Assert .notNull (example , "Example must not be null" );
598
- Assert .notNull (queryFunction , "Query function must not be null" );
601
+ Assert .notNull (example , EXAMPLE_MUST_NOT_BE_NULL );
602
+ Assert .notNull (queryFunction , QUERY_FUNCTION_MUST_NOT_BE_NULL );
599
603
600
604
ExampleSpecification <S > spec = new ExampleSpecification <>(example , escapeCharacter );
601
605
Class <S > probeType = example .getProbeType ();
@@ -622,7 +626,7 @@ public long count(@Nullable Specification<T> spec) {
622
626
@ Transactional
623
627
public <S extends T > S save (S entity ) {
624
628
625
- Assert .notNull (entity , "Entity must not be null" );
629
+ Assert .notNull (entity , ENTITY_MUST_NOT_BE_NULL );
626
630
627
631
if (entityInformation .isNew (entity )) {
628
632
entityManager .persist (entity );
@@ -997,7 +1001,7 @@ private static class ExampleSpecification<T> implements Specification<T> {
997
1001
*/
998
1002
ExampleSpecification (Example <T > example , EscapeCharacter escapeCharacter ) {
999
1003
1000
- Assert .notNull (example , "Example must not be null" );
1004
+ Assert .notNull (example , EXAMPLE_MUST_NOT_BE_NULL );
1001
1005
Assert .notNull (escapeCharacter , "EscapeCharacter must not be null" );
1002
1006
1003
1007
this .example = example ;
0 commit comments