Polishing.

Remove duplicate license headers. Avoid fully-qualified type usage where possible.

See #2708
This commit is contained in:
Mark Paluch
2022-11-02 10:34:45 +01:00
parent 8d424855da
commit 5b784d006f
5 changed files with 21 additions and 114 deletions

View File

@@ -22,6 +22,7 @@ import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.querydsl.QuerydslUtils;
import org.springframework.data.querydsl.ReactiveQuerydslPredicateExecutor;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
@@ -29,15 +30,18 @@ import org.springframework.util.ClassUtils;
import com.querydsl.core.types.Predicate;
/**
* {@link RuntimeHintsRegistrar} holding required hints to bootstrap Querydsl repositories. <br />
* Already registered via {@literal aot.factories}.
*
* @author Christoph Strobl
* @since 4.0
* @since 3.0
*/
public class QuerydslHints implements RuntimeHintsRegistrar {
class QuerydslHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
if (ClassUtils.isPresent("com.querydsl.core.types.Predicate", classLoader)) {
if (QuerydslUtils.QUERY_DSL_PRESENT) {
// repository infrastructure
hints.reflection().registerTypes(Arrays.asList( //
@@ -47,6 +51,7 @@ public class QuerydslHints implements RuntimeHintsRegistrar {
});
if (ClassUtils.isPresent("reactor.core.publisher.Flux", classLoader)) {
// repository infrastructure
hints.reflection().registerTypes(Arrays.asList( //
TypeReference.of(ReactiveQuerydslPredicateExecutor.class)), builder -> {

View File

@@ -13,38 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2022. the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.repository.config;
import java.lang.reflect.Method;

View File

@@ -13,38 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2022. the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.repository.config;
import java.lang.annotation.Annotation;
@@ -55,11 +23,10 @@ import java.util.stream.Collectors;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.core.annotation.MergedAnnotation;
import org.springframework.data.aot.AotContext;
import org.springframework.data.repository.config.AotRepositoryContext;
import org.springframework.data.util.TypeCollector;
import org.springframework.data.util.TypeUtils;
import org.springframework.data.repository.core.RepositoryInformation;
import org.springframework.data.util.Lazy;
import org.springframework.data.util.TypeCollector;
import org.springframework.data.util.TypeUtils;
/**
* Default implementation of {@link AotRepositoryContext}

View File

@@ -13,38 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2022. the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.repository.config;
import java.util.ArrayList;

View File

@@ -35,7 +35,6 @@ import java.util.function.Predicate;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.ResolvableType;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
@@ -178,15 +177,15 @@ public class TypeCollector {
Predicate<Method> excludedDomainsPredicate = methodToTest -> excludedDomainsFilter
.test(methodToTest.getDeclaringClass());
Predicate<Method> excludedMethodsPredicate = org.springframework.data.util.Predicates.IS_BRIDGE_METHOD //
.or(org.springframework.data.util.Predicates.IS_STATIC) //
.or(org.springframework.data.util.Predicates.IS_SYNTHETIC) //
.or(org.springframework.data.util.Predicates.IS_NATIVE) //
.or(org.springframework.data.util.Predicates.IS_PRIVATE) //
.or(org.springframework.data.util.Predicates.IS_PROTECTED) //
.or(org.springframework.data.util.Predicates.IS_OBJECT_MEMBER) //
.or(org.springframework.data.util.Predicates.IS_HIBERNATE_MEMBER) //
.or(org.springframework.data.util.Predicates.IS_ENUM_MEMBER) //
Predicate<Method> excludedMethodsPredicate = Predicates.IS_BRIDGE_METHOD //
.or(Predicates.IS_STATIC) //
.or(Predicates.IS_SYNTHETIC) //
.or(Predicates.IS_NATIVE) //
.or(Predicates.IS_PRIVATE) //
.or(Predicates.IS_PROTECTED) //
.or(Predicates.IS_OBJECT_MEMBER) //
.or(Predicates.IS_HIBERNATE_MEMBER) //
.or(Predicates.IS_ENUM_MEMBER) //
.or(excludedDomainsPredicate.negate()); //
return excludedMethodsPredicate.negate();
@@ -195,8 +194,8 @@ public class TypeCollector {
@SuppressWarnings("rawtypes")
private Predicate<Field> createFieldFilter() {
Predicate<Member> excludedFieldPredicate = org.springframework.data.util.Predicates.IS_HIBERNATE_MEMBER //
.or(org.springframework.data.util.Predicates.IS_SYNTHETIC) //
Predicate<Member> excludedFieldPredicate = Predicates.IS_HIBERNATE_MEMBER //
.or(Predicates.IS_SYNTHETIC) //
.or(Predicates.IS_JAVA);
return (Predicate) excludedFieldPredicate.negate();