Skip to content

Commit a5da12f

Browse files
Polishing.
Rename TypeCollectorPredicateProvider -> TypeCollectorFilters Update javadoc and deprecate jpa specific predicate. Original Pull Request: #3363
1 parent 0dc961c commit a5da12f

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

src/main/java/org/springframework/data/aot/ManagedTypesBeanRegistrationAotProcessor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ protected BeanRegistrationAotContribution contribute(AotContext aotContext, Mana
135135
* Customization hook to configure {@link TypeCollector}.
136136
*
137137
* @return a {@link Consumer} to customize the {@link TypeCollector}, must not be {@literal null}.
138+
* @since 4.0
138139
*/
139140
protected Consumer<TypeCollector> typeCollectorCustomizer() {
140141
return typeCollector -> {};
@@ -168,6 +169,7 @@ protected void contributeType(ResolvableType type, GenerationContext generationC
168169
*
169170
* @param type the class to configure the contribution for.
170171
* @param aotContext AOT context for type configuration.
172+
* @since 4.0
171173
*/
172174
protected void configureTypeContribution(Class<?> type, AotContext aotContext) {
173175
aotContext.typeConfiguration(type, config -> config.forDataBinding().contributeAccessors().forQuerydsl());

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@
3333
public interface Predicates {
3434

3535
Predicate<Member> IS_ENUM_MEMBER = member -> member.getDeclaringClass().isEnum();
36-
Predicate<Member> IS_HIBERNATE_MEMBER = member -> member.getName().startsWith("$$_hibernate"); // this
37-
// should
38-
// go
39-
// into
40-
// JPA
36+
37+
@Deprecated(since = "4.0", forRemoval = true)
38+
Predicate<Member> IS_HIBERNATE_MEMBER = member -> member.getName().startsWith("$$_hibernate");
4139
Predicate<Member> IS_OBJECT_MEMBER = member -> Object.class.equals(member.getDeclaringClass());
4240
Predicate<Member> IS_JAVA = member -> member.getDeclaringClass().getPackageName().startsWith("java.");
4341
Predicate<Member> IS_NATIVE = member -> Modifier.isNative(member.getModifiers());

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
* that returns {@code false}. Filters are {@link Predicate#and(Predicate) combined} so that multiple filters can be
5353
* taken into account. A type/field/method must pass all filters to be considered for further inspection.
5454
* <p>
55-
* The collector uses {@link AotServices} to discover implementations of {@link TypeCollectorPredicateProvider} so that
55+
* The collector uses {@link AotServices} to discover implementations of {@link TypeCollectorFilters} so that
5656
* components using {@link TypeCollector} can contribute their own filtering logic to exclude types, fields, and methods
5757
* from being inspected.
5858
*
@@ -66,8 +66,8 @@ public class TypeCollector {
6666

6767
private static final Log logger = LogFactory.getLog(TypeCollector.class);
6868

69-
private static final AotServices<TypeCollectorPredicateProvider> providers = AotServices.factories()
70-
.load(TypeCollectorPredicateProvider.class);
69+
private static final AotServices<TypeCollectorFilters> providers = AotServices.factories()
70+
.load(TypeCollectorFilters.class);
7171

7272
private Predicate<Class<?>> typeFilter = Predicates.isTrue();
7373

@@ -76,7 +76,7 @@ public class TypeCollector {
7676
private Predicate<Field> fieldFilter = Predicates.isTrue();
7777

7878
/**
79-
* Create a new {@link TypeCollector} applying all {@link TypeCollectorPredicateProvider} discovered through
79+
* Create a new {@link TypeCollector} applying all {@link TypeCollectorFilters} discovered through
8080
* {@link AotServices}.
8181
*/
8282
public TypeCollector() {
@@ -105,6 +105,7 @@ public TypeCollector filterTypes(Predicate<Class<?>> filter) {
105105
*
106106
* @param filter filter predicate matching a {@link Class}.
107107
* @return {@code this} TypeCollector instance.
108+
* @since 4.0
108109
*/
109110
@Contract("_ -> this")
110111
public TypeCollector filterMethods(Predicate<Method> filter) {
@@ -117,6 +118,7 @@ public TypeCollector filterMethods(Predicate<Method> filter) {
117118
*
118119
* @param filter filter predicate matching a {@link Class}.
119120
* @return {@code this} TypeCollector instance.
121+
* @since 4.0
120122
*/
121123
@Contract("_ -> this")
122124
public TypeCollector filterFields(Predicate<Field> filter) {
@@ -351,7 +353,7 @@ public int size() {
351353
* @author Mark Paluch
352354
* @since 4.0
353355
*/
354-
public interface TypeCollectorPredicateProvider {
356+
public interface TypeCollectorFilters {
355357

356358
/**
357359
* Return a predicate to filter types.
@@ -383,12 +385,12 @@ default Predicate<Method> methodPredicate() {
383385
}
384386

385387
/**
386-
* Default implementation of {@link TypeCollectorPredicateProvider} that excludes types from certain packages and
388+
* Default implementation of {@link TypeCollectorFilters} that excludes types from certain packages and
387389
* filters out unwanted fields and methods.
388390
*
389391
* @since 4.0
390392
*/
391-
private static class DefaultTypeCollectorPredicateProvider implements TypeCollectorPredicateProvider {
393+
private static class DefaultTypeCollectorFilters implements TypeCollectorFilters {
392394

393395
private static final Set<String> EXCLUDED_DOMAINS = Set.of("java", "sun.", "jdk.", "reactor.", "kotlinx.",
394396
"kotlin.", "org.springframework.core.", "org.springframework.data.mapping.",

src/main/resources/META-INF/spring/aot.factories

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ org.springframework.aot.hint.RuntimeHintsRegistrar=\
88

99
org.springframework.beans.factory.aot.BeanRegistrationAotProcessor=\
1010
org.springframework.data.aot.AuditingBeanRegistrationAotProcessor
11-
org.springframework.data.util.TypeCollector$TypeCollectorPredicateProvider=\
12-
org.springframework.data.util.TypeCollector$DefaultTypeCollectorPredicateProvider
11+
12+
org.springframework.data.util.TypeCollector$TypeCollectorFilters=\
13+
org.springframework.data.util.TypeCollector$DefaultTypeCollectorFilters

0 commit comments

Comments
 (0)