Skip to content

Commit 5b784d0

Browse files
committed
Polishing.
Remove duplicate license headers. Avoid fully-qualified type usage where possible. See #2708
1 parent 8d42485 commit 5b784d0

File tree

5 files changed

+21
-114
lines changed

5 files changed

+21
-114
lines changed

src/main/java/org/springframework/data/querydsl/aot/QuerydslHints.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,26 @@
2222
import org.springframework.aot.hint.RuntimeHintsRegistrar;
2323
import org.springframework.aot.hint.TypeReference;
2424
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
25+
import org.springframework.data.querydsl.QuerydslUtils;
2526
import org.springframework.data.querydsl.ReactiveQuerydslPredicateExecutor;
2627
import org.springframework.lang.Nullable;
2728
import org.springframework.util.ClassUtils;
2829

2930
import com.querydsl.core.types.Predicate;
3031

3132
/**
33+
* {@link RuntimeHintsRegistrar} holding required hints to bootstrap Querydsl repositories. <br />
34+
* Already registered via {@literal aot.factories}.
35+
*
3236
* @author Christoph Strobl
33-
* @since 4.0
37+
* @since 3.0
3438
*/
35-
public class QuerydslHints implements RuntimeHintsRegistrar {
39+
class QuerydslHints implements RuntimeHintsRegistrar {
3640

3741
@Override
3842
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
3943

40-
if (ClassUtils.isPresent("com.querydsl.core.types.Predicate", classLoader)) {
44+
if (QuerydslUtils.QUERY_DSL_PRESENT) {
4145

4246
// repository infrastructure
4347
hints.reflection().registerTypes(Arrays.asList( //
@@ -47,6 +51,7 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
4751
});
4852

4953
if (ClassUtils.isPresent("reactor.core.publisher.Flux", classLoader)) {
54+
5055
// repository infrastructure
5156
hints.reflection().registerTypes(Arrays.asList( //
5257
TypeReference.of(ReactiveQuerydslPredicateExecutor.class)), builder -> {

src/main/java/org/springframework/data/repository/config/AotRepositoryInformation.java

-32
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
17-
/*
18-
* Copyright 2022. the original author or authors.
19-
*
20-
* Licensed under the Apache License, Version 2.0 (the "License");
21-
* you may not use this file except in compliance with the License.
22-
* You may obtain a copy of the License at
23-
*
24-
* http://www.apache.org/licenses/LICENSE-2.0
25-
*
26-
* Unless required by applicable law or agreed to in writing, software
27-
* distributed under the License is distributed on an "AS IS" BASIS,
28-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29-
* See the License for the specific language governing permissions and
30-
* limitations under the License.
31-
*/
32-
33-
/*
34-
* Copyright 2022 the original author or authors.
35-
*
36-
* Licensed under the Apache License, Version 2.0 (the "License");
37-
* you may not use this file except in compliance with the License.
38-
* You may obtain a copy of the License at
39-
*
40-
* https://www.apache.org/licenses/LICENSE-2.0
41-
*
42-
* Unless required by applicable law or agreed to in writing, software
43-
* distributed under the License is distributed on an "AS IS" BASIS,
44-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
45-
* See the License for the specific language governing permissions and
46-
* limitations under the License.
47-
*/
4816
package org.springframework.data.repository.config;
4917

5018
import java.lang.reflect.Method;

src/main/java/org/springframework/data/repository/config/DefaultAotRepositoryContext.java

+2-35
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
17-
/*
18-
* Copyright 2022. the original author or authors.
19-
*
20-
* Licensed under the Apache License, Version 2.0 (the "License");
21-
* you may not use this file except in compliance with the License.
22-
* You may obtain a copy of the License at
23-
*
24-
* http://www.apache.org/licenses/LICENSE-2.0
25-
*
26-
* Unless required by applicable law or agreed to in writing, software
27-
* distributed under the License is distributed on an "AS IS" BASIS,
28-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29-
* See the License for the specific language governing permissions and
30-
* limitations under the License.
31-
*/
32-
33-
/*
34-
* Copyright 2022 the original author or authors.
35-
*
36-
* Licensed under the Apache License, Version 2.0 (the "License");
37-
* you may not use this file except in compliance with the License.
38-
* You may obtain a copy of the License at
39-
*
40-
* https://www.apache.org/licenses/LICENSE-2.0
41-
*
42-
* Unless required by applicable law or agreed to in writing, software
43-
* distributed under the License is distributed on an "AS IS" BASIS,
44-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
45-
* See the License for the specific language governing permissions and
46-
* limitations under the License.
47-
*/
4816
package org.springframework.data.repository.config;
4917

5018
import java.lang.annotation.Annotation;
@@ -55,11 +23,10 @@
5523
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
5624
import org.springframework.core.annotation.MergedAnnotation;
5725
import org.springframework.data.aot.AotContext;
58-
import org.springframework.data.repository.config.AotRepositoryContext;
59-
import org.springframework.data.util.TypeCollector;
60-
import org.springframework.data.util.TypeUtils;
6126
import org.springframework.data.repository.core.RepositoryInformation;
6227
import org.springframework.data.util.Lazy;
28+
import org.springframework.data.util.TypeCollector;
29+
import org.springframework.data.util.TypeUtils;
6330

6431
/**
6532
* Default implementation of {@link AotRepositoryContext}

src/main/java/org/springframework/data/repository/config/RepositoryBeanDefinitionReader.java

-32
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
17-
/*
18-
* Copyright 2022. the original author or authors.
19-
*
20-
* Licensed under the Apache License, Version 2.0 (the "License");
21-
* you may not use this file except in compliance with the License.
22-
* You may obtain a copy of the License at
23-
*
24-
* http://www.apache.org/licenses/LICENSE-2.0
25-
*
26-
* Unless required by applicable law or agreed to in writing, software
27-
* distributed under the License is distributed on an "AS IS" BASIS,
28-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29-
* See the License for the specific language governing permissions and
30-
* limitations under the License.
31-
*/
32-
33-
/*
34-
* Copyright 2022 the original author or authors.
35-
*
36-
* Licensed under the Apache License, Version 2.0 (the "License");
37-
* you may not use this file except in compliance with the License.
38-
* You may obtain a copy of the License at
39-
*
40-
* https://www.apache.org/licenses/LICENSE-2.0
41-
*
42-
* Unless required by applicable law or agreed to in writing, software
43-
* distributed under the License is distributed on an "AS IS" BASIS,
44-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
45-
* See the License for the specific language governing permissions and
46-
* limitations under the License.
47-
*/
4816
package org.springframework.data.repository.config;
4917

5018
import java.util.ArrayList;

src/main/java/org/springframework/data/util/TypeCollector.java

+11-12
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535

3636
import org.apache.commons.logging.Log;
3737
import org.apache.commons.logging.LogFactory;
38-
3938
import org.springframework.core.ResolvableType;
4039
import org.springframework.util.ObjectUtils;
4140
import org.springframework.util.ReflectionUtils;
@@ -178,15 +177,15 @@ private Predicate<Method> createMethodFilter() {
178177
Predicate<Method> excludedDomainsPredicate = methodToTest -> excludedDomainsFilter
179178
.test(methodToTest.getDeclaringClass());
180179

181-
Predicate<Method> excludedMethodsPredicate = org.springframework.data.util.Predicates.IS_BRIDGE_METHOD //
182-
.or(org.springframework.data.util.Predicates.IS_STATIC) //
183-
.or(org.springframework.data.util.Predicates.IS_SYNTHETIC) //
184-
.or(org.springframework.data.util.Predicates.IS_NATIVE) //
185-
.or(org.springframework.data.util.Predicates.IS_PRIVATE) //
186-
.or(org.springframework.data.util.Predicates.IS_PROTECTED) //
187-
.or(org.springframework.data.util.Predicates.IS_OBJECT_MEMBER) //
188-
.or(org.springframework.data.util.Predicates.IS_HIBERNATE_MEMBER) //
189-
.or(org.springframework.data.util.Predicates.IS_ENUM_MEMBER) //
180+
Predicate<Method> excludedMethodsPredicate = Predicates.IS_BRIDGE_METHOD //
181+
.or(Predicates.IS_STATIC) //
182+
.or(Predicates.IS_SYNTHETIC) //
183+
.or(Predicates.IS_NATIVE) //
184+
.or(Predicates.IS_PRIVATE) //
185+
.or(Predicates.IS_PROTECTED) //
186+
.or(Predicates.IS_OBJECT_MEMBER) //
187+
.or(Predicates.IS_HIBERNATE_MEMBER) //
188+
.or(Predicates.IS_ENUM_MEMBER) //
190189
.or(excludedDomainsPredicate.negate()); //
191190

192191
return excludedMethodsPredicate.negate();
@@ -195,8 +194,8 @@ private Predicate<Method> createMethodFilter() {
195194
@SuppressWarnings("rawtypes")
196195
private Predicate<Field> createFieldFilter() {
197196

198-
Predicate<Member> excludedFieldPredicate = org.springframework.data.util.Predicates.IS_HIBERNATE_MEMBER //
199-
.or(org.springframework.data.util.Predicates.IS_SYNTHETIC) //
197+
Predicate<Member> excludedFieldPredicate = Predicates.IS_HIBERNATE_MEMBER //
198+
.or(Predicates.IS_SYNTHETIC) //
200199
.or(Predicates.IS_JAVA);
201200

202201
return (Predicate) excludedFieldPredicate.negate();

0 commit comments

Comments
 (0)