Browse Source

Polishing.

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

See #2708
pull/2730/head
Mark Paluch 3 years ago
parent
commit
5b784d006f
No known key found for this signature in database
GPG Key ID: 4406B84C1661DCD1
  1. 11
      src/main/java/org/springframework/data/querydsl/aot/QuerydslHints.java
  2. 32
      src/main/java/org/springframework/data/repository/config/AotRepositoryInformation.java
  3. 37
      src/main/java/org/springframework/data/repository/config/DefaultAotRepositoryContext.java
  4. 32
      src/main/java/org/springframework/data/repository/config/RepositoryBeanDefinitionReader.java
  5. 23
      src/main/java/org/springframework/data/util/TypeCollector.java

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

@ -22,6 +22,7 @@ import org.springframework.aot.hint.RuntimeHints; @@ -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; @@ -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 { @@ -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 -> {

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

@ -13,38 +13,6 @@ @@ -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;

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

@ -13,38 +13,6 @@ @@ -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; @@ -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}

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

@ -13,38 +13,6 @@ @@ -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;

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

@ -35,7 +35,6 @@ import java.util.function.Predicate; @@ -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 { @@ -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 { @@ -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();

Loading…
Cancel
Save