Skip to content

Commit f0f5693

Browse files
committed
Add DirContextProcessor Runtime Hints
Closes gh-721
1 parent 7dd18fd commit f0f5693

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

core/src/main/java/org/springframework/ldap/aot/hint/LdapCoreRuntimeHints.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1+
/*
2+
* Copyright 2005-2023 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.springframework.ldap.aot.hint;
218

319
import org.springframework.aot.hint.MemberCategory;
420
import org.springframework.aot.hint.RuntimeHints;
521
import org.springframework.aot.hint.RuntimeHintsRegistrar;
622
import org.springframework.aot.hint.TypeReference;
23+
import org.springframework.ldap.control.PagedResultsDirContextProcessor;
24+
import org.springframework.ldap.control.SortControlDirContextProcessor;
725
import org.springframework.ldap.core.support.AbstractContextSource;
826
import org.springframework.ldap.core.support.DefaultDirObjectFactory;
927

@@ -23,6 +41,30 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
2341
.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS));
2442
hints.reflection().registerType(DefaultDirObjectFactory.class,
2543
(builder) -> builder.withMembers(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
44+
hints.reflection().registerTypeIfPresent(classLoader, "javax.naming.ldap.PagedResultsControl",
45+
(builder) -> builder.onReachableType(PagedResultsDirContextProcessor.class)
46+
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
47+
hints.reflection().registerTypeIfPresent(classLoader, "com.sun.jndi.ldap.ctl.PagedResultsControl",
48+
(builder) -> builder.onReachableType(PagedResultsDirContextProcessor.class)
49+
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
50+
hints.reflection().registerTypeIfPresent(classLoader, "javax.naming.ldap.PagedResultsResponseControl",
51+
(builder) -> builder.onReachableType(PagedResultsDirContextProcessor.class)
52+
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
53+
hints.reflection().registerTypeIfPresent(classLoader, "com.sun.jndi.ldap.ctl.PagedResultsResponseControl",
54+
(builder) -> builder.onReachableType(PagedResultsDirContextProcessor.class)
55+
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
56+
hints.reflection().registerTypeIfPresent(classLoader, "javax.naming.ldap.SortControl",
57+
(builder) -> builder.onReachableType(SortControlDirContextProcessor.class)
58+
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
59+
hints.reflection().registerTypeIfPresent(classLoader, "com.sun.jndi.ldap.ctl.SortControl",
60+
(builder) -> builder.onReachableType(SortControlDirContextProcessor.class)
61+
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
62+
hints.reflection().registerTypeIfPresent(classLoader, "javax.naming.ldap.SortResponseControl",
63+
(builder) -> builder.onReachableType(SortControlDirContextProcessor.class)
64+
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
65+
hints.reflection().registerTypeIfPresent(classLoader, "com.sun.jndi.ldap.ctl.SortResponseControl",
66+
(builder) -> builder.onReachableType(SortControlDirContextProcessor.class)
67+
.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
2668
}
2769

2870
}

0 commit comments

Comments
 (0)