Polishing.

Add missing Override annotations. Use instanceof pattern variables, use diamond operator where possible.

Closes #3162
This commit is contained in:
Tran Ngoc Nhan
2024-09-26 11:27:29 +02:00
committed by Mark Paluch
parent 737502c4e4
commit f67cb87bf8
96 changed files with 229 additions and 63 deletions

View File

@@ -39,7 +39,7 @@ class DefaultAotContext implements AotContext {
private final ConfigurableListableBeanFactory factory;
public DefaultAotContext(BeanFactory beanFactory) {
factory = beanFactory instanceof ConfigurableListableBeanFactory ? (ConfigurableListableBeanFactory) beanFactory
factory = beanFactory instanceof ConfigurableListableBeanFactory cbf ? cbf
: new DefaultListableBeanFactory(beanFactory);
}

View File

@@ -66,6 +66,7 @@ public class ConfigurableTypeInformationMapper implements TypeInformationMapper
}
}
@Override
public Alias createAliasFor(TypeInformation<?> type) {
return typeToAlias.getOrDefault(type, Alias.NONE);
}

View File

@@ -58,6 +58,7 @@ public class MappingContextTypeInformationMapper implements TypeInformationMappe
}
}
@Override
public Alias createAliasFor(TypeInformation<?> type) {
return typeMap.computeIfAbsent(type.getRawTypeInformation(), key -> {

View File

@@ -81,6 +81,7 @@ public class SimplePropertyValueConverterRegistry<P extends PersistentProperty<P
return converterRegistrationMap.size();
}
@Override
public boolean isEmpty() {
return converterRegistrationMap.isEmpty();
}

View File

@@ -41,6 +41,7 @@ public class HashMapChangeSet implements ChangeSet {
this(new HashMap<>());
}
@Override
public void set(String key, Object o) {
values.put(key, o);
}
@@ -49,15 +50,18 @@ public class HashMapChangeSet implements ChangeSet {
return "HashMapChangeSet: values=[" + values + "]";
}
@Override
public Map<String, Object> getValues() {
return Collections.unmodifiableMap(values);
}
@Override
@Nullable
public Object removeProperty(String k) {
return this.values.remove(k);
}
@Override
@Nullable
public <T> T get(String key, Class<T> requiredClass, ConversionService conversionService) {

View File

@@ -54,42 +54,52 @@ abstract class Chunk<T> implements Slice<T>, Serializable {
this.pageable = pageable;
}
@Override
public int getNumber() {
return pageable.isPaged() ? pageable.getPageNumber() : 0;
}
@Override
public int getSize() {
return pageable.isPaged() ? pageable.getPageSize() : content.size();
}
@Override
public int getNumberOfElements() {
return content.size();
}
@Override
public boolean hasPrevious() {
return getNumber() > 0;
}
@Override
public boolean isFirst() {
return !hasPrevious();
}
@Override
public boolean isLast() {
return !hasNext();
}
@Override
public Pageable nextPageable() {
return hasNext() ? pageable.next() : Pageable.unpaged();
}
@Override
public Pageable previousPageable() {
return hasPrevious() ? pageable.previousOrFirst() : Pageable.unpaged();
}
@Override
public boolean hasContent() {
return !content.isEmpty();
}
@Override
public List<T> getContent() {
return Collections.unmodifiableList(content);
}

View File

@@ -69,5 +69,6 @@ public interface Page<T> extends Slice<T> {
* @return a new {@link Page} with the content of the current one mapped by the given {@link Function}.
* @since 1.10
*/
@Override
<U> Page<U> map(Function<? super T, ? extends U> converter);
}

View File

@@ -97,6 +97,7 @@ public class PageRequest extends AbstractPageRequest {
return PageRequest.of(0, pageSize);
}
@Override
public Sort getSort() {
return sort;
}

View File

@@ -136,6 +136,7 @@ public interface Slice<T> extends Streamable<T> {
* @return a new {@link Slice} with the content of the current one mapped by the given {@link Converter}.
* @since 1.10
*/
@Override
<U> Slice<U> map(Function<? super T, ? extends U> converter);
/**

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.data.domain;
import java.io.Serial;
import java.util.List;
import java.util.function.Function;
@@ -29,6 +30,7 @@ import org.springframework.lang.Nullable;
*/
public class SliceImpl<T> extends Chunk<T> {
@Serial
private static final long serialVersionUID = 867755909294344406L;
private final boolean hasNext;
@@ -59,6 +61,7 @@ public class SliceImpl<T> extends Chunk<T> {
this(content, Pageable.unpaged(), false);
}
@Override
public boolean hasNext() {
return hasNext;
}
@@ -74,7 +77,7 @@ public class SliceImpl<T> extends Chunk<T> {
String contentType = "UNKNOWN";
List<T> content = getContent();
if (content.size() > 0) {
if (!content.isEmpty()) {
contentType = content.get(0).getClass().getName();
}

View File

@@ -204,7 +204,7 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
Assert.notNull(sort, "Sort must not be null");
List<Order> these = new ArrayList<Order>(this.toList());
List<Order> these = new ArrayList<>(this.toList());
for (Order order : sort) {
these.add(order);

View File

@@ -38,10 +38,12 @@ class TypedExample<T> implements Example<T> {
this.matcher = matcher;
}
@Override
public T getProbe() {
return this.probe;
}
@Override
public ExampleMatcher getMatcher() {
return this.matcher;
}

View File

@@ -72,6 +72,7 @@ public interface Window<T> extends Streamable<T> {
*
* @return {@code true} if this window contains no elements
*/
@Override
boolean isEmpty();
/**
@@ -149,6 +150,7 @@ public interface Window<T> extends Streamable<T> {
* @param converter must not be {@literal null}.
* @return a new {@link Window} with the content of the current one mapped by the given {@code converter}.
*/
@Override
<U> Window<U> map(Function<? super T, ? extends U> converter);
}

View File

@@ -55,6 +55,7 @@ public class CustomMetric implements Metric {
this.abbreviation = abbreviation;
}
@Override
public double getMultiplier() {
return multiplier;
}

View File

@@ -41,6 +41,7 @@ public enum Metrics implements Metric {
this.abbreviation = abbreviation;
}
@Override
public double getMultiplier() {
return multiplier;
}

View File

@@ -84,18 +84,22 @@ public class AnnotationRevisionMetadata<N extends Number & Comparable<N>> implem
this.revisionType = revisionType;
}
@Override
public Optional<N> getRevisionNumber() {
return revisionNumber.get();
}
@Override
public Optional<Instant> getRevisionInstant() {
return revisionDate.get().map(AnnotationRevisionMetadata::convertToInstant);
}
@Override
public RevisionType getRevisionType() {
return revisionType;
}
@Override
@SuppressWarnings("unchecked")
public <T> T getDelegate() {
return (T) entity;

View File

@@ -186,7 +186,7 @@ public class AccessOptions {
Assert.isTrue(type.isAssignableFrom(property.getType()), () -> String
.format("Cannot register a property handler for %s on a property of type %s", type, property.getType()));
Function<Object, T> caster = (Function<Object, T>) it -> type.cast(it);
Function<Object, T> caster = type::cast;
return registerHandler(property, caster.andThen(handler));
}

View File

@@ -67,6 +67,7 @@ class InstanceCreatorMetadataSupport<T, P extends PersistentProperty<P>> impleme
*
* @return
*/
@Override
public List<Parameter<Object, P>> getParameters() {
return parameters;
}

View File

@@ -258,7 +258,7 @@ public class PropertyPath implements Streamable<PropertyPath> {
@Override
public Iterator<PropertyPath> iterator() {
return new Iterator<PropertyPath>() {
return new Iterator<>() {
private @Nullable PropertyPath current = PropertyPath.this;
@@ -377,7 +377,7 @@ public class PropertyPath implements Streamable<PropertyPath> {
Iterator<String> parts = iteratorSource.iterator();
PropertyPath result = null;
Stack<PropertyPath> current = new Stack<PropertyPath>();
Stack<PropertyPath> current = new Stack<>();
while (parts.hasNext()) {
if (result == null) {

View File

@@ -310,7 +310,7 @@ class EntityCallbackDiscoverer {
for (var beanName : bf.getBeanNamesForType(EntityCallback.class)) {
EntityCallback<?> bean = EntityCallback.class.cast(bf.getBean(beanName));
EntityCallback<?> bean = (EntityCallback) bf.getBean(beanName);
ResolvableType type = ResolvableType.forClass(EntityCallback.class, bean.getClass());
ResolvableType entityType = type.getGeneric(0);

View File

@@ -135,7 +135,7 @@ class DefaultPersistentPropertyPath<P extends PersistentProperty<P>> implements
@Override
public P getLeafProperty() {
Assert.state(properties.size() > 0, "Empty PersistentPropertyPath should not exist");
Assert.state(!properties.isEmpty(), "Empty PersistentPropertyPath should not exist");
return properties.get(properties.size() - 1);
}
@@ -143,7 +143,7 @@ class DefaultPersistentPropertyPath<P extends PersistentProperty<P>> implements
@Override
public P getBaseProperty() {
Assert.state(properties.size() > 0, "Empty PersistentPropertyPath should not exist");
Assert.state(!properties.isEmpty(), "Empty PersistentPropertyPath should not exist");
return properties.get(0);
}
@@ -208,10 +208,17 @@ class DefaultPersistentPropertyPath<P extends PersistentProperty<P>> implements
*/
public boolean containsPropertyOfType(@Nullable TypeInformation<?> type) {
return type == null //
? false //
: properties.stream() //
.anyMatch(property -> type.equals(property.getTypeInformation().getActualType()));
if (type == null) {
return false;
}
for (P property : properties) {
if (type.equals(property.getTypeInformation().getActualType())) {
return true;
}
}
return false;
}
@Override

View File

@@ -431,7 +431,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
Iterator<P> iterator = properties.iterator();
return new Iterator<P>() {
return new Iterator<>() {
@Override
public boolean hasNext() {

View File

@@ -56,6 +56,7 @@ class BeanWrapper<T> implements PersistentPropertyAccessor<T> {
this.bean = bean;
}
@Override
@SuppressWarnings("unchecked")
public void setProperty(PersistentProperty<?> property, @Nullable Object value) {
@@ -103,6 +104,7 @@ class BeanWrapper<T> implements PersistentPropertyAccessor<T> {
}
}
@Override
@Nullable
public Object getProperty(PersistentProperty<?> property) {
return getProperty(property, property.getType());
@@ -143,6 +145,7 @@ class BeanWrapper<T> implements PersistentPropertyAccessor<T> {
}
}
@Override
public T getBean() {
return bean;
}

View File

@@ -45,6 +45,7 @@ public class DefaultSpELExpressionEvaluator implements SpELExpressionEvaluator {
this.factory = factory;
}
@Override
@Nullable
@SuppressWarnings("unchecked")
public <T> T evaluate(String expression) {

View File

@@ -54,6 +54,7 @@ public class IdPropertyIdentifierAccessor extends TargetAwareIdentifierAccessor
this.accessor = entity.getPropertyAccessor(target);
}
@Override
@Nullable
public Object getIdentifier() {
return accessor.getProperty(idProperty);

View File

@@ -435,7 +435,7 @@ class KotlinValueUtils {
ValueBoxing hierarchy = this;
while (hierarchy != null) {
if (sb.length() != 0) {
if (!sb.isEmpty()) {
sb.append(" -> ");
}

View File

@@ -100,8 +100,8 @@ class PersistentEntityIsNewStrategy implements IsNewStrategy {
return false;
}
if (value instanceof Number) {
return ((Number) value).longValue() == 0;
if (value instanceof Number n) {
return n.longValue() == 0;
}
throw new IllegalArgumentException(

View File

@@ -264,7 +264,7 @@ public class Property {
private static Optional<Method> findWither(TypeInformation<?> owner, String propertyName, Class<?> rawType) {
AtomicReference<Method> resultHolder = new AtomicReference<Method>();
AtomicReference<Method> resultHolder = new AtomicReference<>();
String methodName = String.format("with%s", StringUtils.capitalize(propertyName));
ReflectionUtils.doWithMethods(owner.getType(), it -> {

View File

@@ -27,6 +27,7 @@ public enum PropertyNameFieldNamingStrategy implements FieldNamingStrategy {
INSTANCE;
@Override
public String getFieldName(PersistentProperty<?> property) {
return property.getName();
}

View File

@@ -47,6 +47,7 @@ enum ReflectionEntityInstantiator implements EntityInstantiator {
private static final Object[] EMPTY_ARGS = new Object[0];
@Override
@SuppressWarnings("unchecked")
public <T, E extends PersistentEntity<? extends T, P>, P extends PersistentProperty<P>> T createInstance(E entity,
ParameterValueProvider<P> provider) {

View File

@@ -167,7 +167,7 @@ class SimplePersistentPropertyPathAccessor<T> implements PersistentPropertyPathA
.map(it -> setValue(it, leafProperty, value)) //
.collect(Collectors.toCollection(() -> CollectionFactory.createApproximateCollection(source, source.size())));
} else if (Map.class.isInstance(parent)) {
} else if (parent instanceof Map) {
Map<Object, Object> source = getTypedProperty(parentProperty, Map.class);

View File

@@ -261,7 +261,7 @@ class ProxyProjectionFactory implements ProjectionFactory, BeanClassLoaderAware
@Override
public boolean supports(Object source, Class<?> targetType) {
return Map.class.isInstance(source);
return source instanceof Map;
}
}

View File

@@ -108,7 +108,7 @@ public class SpelAwareProxyProjectionFactory extends ProxyProjectionFactory impl
Assert.notNull(type, "Type must not be null");
AnnotationDetectionMethodCallback<Value> callback = new AnnotationDetectionMethodCallback<Value>(Value.class);
AnnotationDetectionMethodCallback<Value> callback = new AnnotationDetectionMethodCallback<>(Value.class);
ReflectionUtils.doWithMethods(type, callback);
return callback.hasFoundAnnotation();

View File

@@ -61,6 +61,7 @@ public class SimpleEntityPathResolver implements EntityPathResolver {
* @param domainClass
* @return
*/
@Override
@SuppressWarnings("unchecked")
public <T> EntityPath<T> createPath(Class<T> domainClass) {

View File

@@ -54,7 +54,7 @@ class QuerydslDefaultBinding implements MultiValueBinding<Path<? extends Object>
return Optional.empty();
}
if (path instanceof CollectionPathBase) {
if (path instanceof CollectionPathBase cpb) {
BooleanBuilder builder = new BooleanBuilder();
@@ -63,10 +63,10 @@ class QuerydslDefaultBinding implements MultiValueBinding<Path<? extends Object>
if (element instanceof Collection<?> nestedCollection) {
for (Object nested : nestedCollection) {
builder.and(((CollectionPathBase) path).contains(nested));
builder.and(cpb.contains(nested));
}
} else {
builder.and(((CollectionPathBase) path).contains(element));
builder.and(cpb.contains(element));
}
}

View File

@@ -83,6 +83,7 @@ class QuerydslPathInformation implements PathInformation {
return QuerydslUtils.toDotPath(path);
}
@Override
public Path<?> reifyPath(EntityPathResolver resolver) {
return path;
}

View File

@@ -42,6 +42,7 @@ public interface ListCrudRepository<T, ID> extends CrudRepository<T, ID> {
* attribute with a different value from that found in the persistence store. Also thrown if at least one
* entity is assumed to be present but does not exist in the database.
*/
@Override
<S extends T> List<S> saveAll(Iterable<S> entities);
/**
@@ -49,6 +50,7 @@ public interface ListCrudRepository<T, ID> extends CrudRepository<T, ID> {
*
* @return all entities
*/
@Override
List<T> findAll();
/**
@@ -63,6 +65,7 @@ public interface ListCrudRepository<T, ID> extends CrudRepository<T, ID> {
* {@literal ids}.
* @throws IllegalArgumentException in case the given {@link Iterable ids} or one of its items is {@literal null}.
*/
@Override
List<T> findAllById(Iterable<ID> ids);
}

View File

@@ -186,6 +186,7 @@ public class CdiRepositoryContext {
return Streamable.empty();
}
@Override
public MetadataReaderFactory getMetadataReaderFactory() {
return this.metadataReaderFactory;
}

View File

@@ -62,10 +62,12 @@ public class DefaultRepositoryConfiguration<T extends RepositoryConfigurationSou
() -> new IllegalStateException("Can't create bean identifier without a repository base class defined"))));
}
@Override
public Object getQueryLookupStrategyKey() {
return configurationSource.getQueryLookupStrategyKey().orElse(DEFAULT_QUERY_LOOKUP_STRATEGY);
}
@Override
public Streamable<String> getBasePackages() {
return configurationSource.getBasePackages();
}
@@ -75,6 +77,7 @@ public class DefaultRepositoryConfiguration<T extends RepositoryConfigurationSou
return Streamable.of(ClassUtils.getPackageName(getRepositoryInterface()));
}
@Override
public String getRepositoryInterface() {
return ConfigurationUtils.getRequiredBeanClassName(definition);
}
@@ -83,6 +86,7 @@ public class DefaultRepositoryConfiguration<T extends RepositoryConfigurationSou
return configurationSource;
}
@Override
public Optional<String> getNamedQueriesLocation() {
return configurationSource.getNamedQueryLocation();
}
@@ -92,6 +96,7 @@ public class DefaultRepositoryConfiguration<T extends RepositoryConfigurationSou
configurationSource.getRepositoryImplementationPostfix().orElse(DEFAULT_REPOSITORY_IMPLEMENTATION_POSTFIX));
}
@Override
public String getImplementationBeanName() {
return beanName.get() + configurationSource.getRepositoryImplementationPostfix().orElse("Impl");
}

View File

@@ -70,8 +70,8 @@ class RepositoryBeanNameGenerator {
*/
public String generateBeanName(BeanDefinition definition) {
AnnotatedBeanDefinition beanDefinition = definition instanceof AnnotatedBeanDefinition //
? (AnnotatedBeanDefinition) definition //
AnnotatedBeanDefinition beanDefinition = definition instanceof AnnotatedBeanDefinition abd //
? abd //
: new AnnotatedGenericBeanDefinition(getRepositoryInterfaceFrom(definition));
return generator.generateBeanName(beanDefinition, registry);

View File

@@ -123,7 +123,7 @@ public class RepositoryConfigurationDelegate {
return environment;
}
return resourceLoader instanceof EnvironmentCapable ? ((EnvironmentCapable) resourceLoader).getEnvironment()
return resourceLoader instanceof EnvironmentCapable capable ? capable.getEnvironment()
: new StandardEnvironment();
}

View File

@@ -69,6 +69,7 @@ public abstract class RepositoryConfigurationExtensionSupport implements Reposit
return getRepositoryConfigurations(configSource, loader, false);
}
@Override
public <T extends RepositoryConfigurationSource> Collection<RepositoryConfiguration<T>> getRepositoryConfigurations(
T configSource, ResourceLoader loader, boolean strictMatchesOnly) {
@@ -101,10 +102,12 @@ public abstract class RepositoryConfigurationExtensionSupport implements Reposit
return result;
}
@Override
public String getDefaultNamedQueryLocation() {
return String.format("classpath*:META-INF/%s-named-queries.properties", getModuleIdentifier());
}
@Override
public void registerBeansForRoot(BeanDefinitionRegistry registry,
RepositoryConfigurationSource configurationSource) {}
@@ -119,10 +122,13 @@ public abstract class RepositoryConfigurationExtensionSupport implements Reposit
@Deprecated
protected abstract String getModulePrefix();
@Override
public void postProcess(BeanDefinitionBuilder builder, RepositoryConfigurationSource source) {}
@Override
public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfigurationSource config) {}
@Override
public void postProcess(BeanDefinitionBuilder builder, XmlRepositoryConfigurationSource config) {}
/**

View File

@@ -149,6 +149,7 @@ public abstract class RepositoryConfigurationSourceSupport implements Repository
return source.generateBeanName(definition);
}
@Override
public MetadataReaderFactory getMetadataReaderFactory() {
return this.metadataReaderFactory;
}

View File

@@ -49,7 +49,7 @@ class SelectionSet<T> {
}
public static <T> SelectionSet<T> of(Collection<T> collection, Function<Collection<T>, Optional<T>> fallback) {
return new SelectionSet<T>(collection, fallback);
return new SelectionSet<>(collection, fallback);
}
/**
@@ -74,7 +74,7 @@ class SelectionSet<T> {
SelectionSet<T> filterIfNecessary(Predicate<T> predicate) {
return findUniqueResult().map(it -> this).orElseGet(
() -> new SelectionSet<T>(collection.stream().filter(predicate).collect(Collectors.toList()), fallback));
() -> new SelectionSet<>(collection.stream().filter(predicate).collect(Collectors.toList()), fallback));
}
private static <S> Function<Collection<S>, Optional<S>> defaultFallback() {

View File

@@ -85,11 +85,13 @@ public class XmlRepositoryConfigurationSource extends RepositoryConfigurationSou
this.excludeFilters = parser.parseTypeFilters(element, Type.EXCLUDE);
}
@Override
@Nullable
public Object getSource() {
return context.extractSource(element);
}
@Override
public Streamable<String> getBasePackages() {
String attribute = element.getAttribute(BASE_PACKAGE);
@@ -97,10 +99,12 @@ public class XmlRepositoryConfigurationSource extends RepositoryConfigurationSou
return Streamable.of(StringUtils.delimitedListToStringArray(attribute, ",", " "));
}
@Override
public Optional<Object> getQueryLookupStrategyKey() {
return getNullDefaultedAttribute(element, QUERY_LOOKUP_STRATEGY).map(Key::create);
}
@Override
public Optional<String> getNamedQueryLocation() {
return getNullDefaultedAttribute(element, NAMED_QUERIES_LOCATION);
}
@@ -124,6 +128,7 @@ public class XmlRepositoryConfigurationSource extends RepositoryConfigurationSou
return includeFilters;
}
@Override
public Optional<String> getRepositoryImplementationPostfix() {
return getNullDefaultedAttribute(element, REPOSITORY_IMPL_POSTFIX);
}

View File

@@ -39,6 +39,7 @@ public abstract class AbstractEntityInformation<T, ID> implements EntityInformat
this.domainClass = domainClass;
}
@Override
public boolean isNew(T entity) {
ID id = getId(entity);
@@ -48,13 +49,14 @@ public abstract class AbstractEntityInformation<T, ID> implements EntityInformat
return id == null;
}
if (id instanceof Number) {
return ((Number) id).longValue() == 0L;
if (id instanceof Number n) {
return n.longValue() == 0L;
}
throw new IllegalArgumentException(String.format("Unsupported primitive id type %s", idType));
}
@Override
public Class<T> getJavaType() {
return this.domainClass;
}

View File

@@ -107,6 +107,7 @@ public abstract class AbstractRepositoryMetadata implements RepositoryMetadata {
return QueryExecutionConverters.unwrapWrapperTypes(returnType, getDomainTypeInformation()).getType();
}
@Override
public Class<?> getRepositoryInterface() {
return this.repositoryInterface;
}

View File

@@ -238,7 +238,7 @@ public class EventPublishingRepositoryProxyPostProcessor implements RepositoryPr
private static <T extends Annotation> AnnotationDetectionMethodCallback<T> getDetector(Class<?> type,
Class<T> annotation) {
AnnotationDetectionMethodCallback<T> callback = new AnnotationDetectionMethodCallback<T>(annotation);
AnnotationDetectionMethodCallback<T> callback = new AnnotationDetectionMethodCallback<>(annotation);
ReflectionUtils.doWithMethods(type, callback);
return callback;
@@ -300,7 +300,7 @@ public class EventPublishingRepositoryProxyPostProcessor implements RepositoryPr
return Collections.emptyList();
}
if (Collection.class.isInstance(source)) {
if (source instanceof Collection) {
return new ArrayList<>((Collection<Object>) source);
}

View File

@@ -47,6 +47,7 @@ public class PersistenceExceptionTranslationRepositoryProxyPostProcessor impleme
this.interceptor.afterPropertiesSet();
}
@Override
public void postProcess(ProxyFactory factory, RepositoryInformation repositoryInformation) {
factory.addAdvice(interceptor);
}

View File

@@ -37,6 +37,7 @@ public class PropertiesBasedNamedQueries implements NamedQueries {
this.properties = properties;
}
@Override
public boolean hasQuery(String queryName) {
Assert.hasText(queryName, "Query name must not be null or empty");
@@ -44,6 +45,7 @@ public class PropertiesBasedNamedQueries implements NamedQueries {
return properties.containsKey(queryName);
}
@Override
public String getQuery(String queryName) {
Assert.hasText(queryName, "Query name must not be null or empty");

View File

@@ -115,7 +115,7 @@ public abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>,
* <p>
* Default is "false", in order to avoid unnecessary extra interception. This means that no guarantees are provided
* that {@code RepositoryMethodContext} access will work consistently within any method of the advised object.
*
*
* @since 3.4.0
*/
public void setExposeMetadata(boolean exposeMetadata) {
@@ -210,7 +210,7 @@ public abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>,
this.beanFactory = beanFactory;
if (!this.evaluationContextProvider.isPresent() && ListableBeanFactory.class.isInstance(beanFactory)) {
if (!this.evaluationContextProvider.isPresent() && beanFactory instanceof ListableBeanFactory) {
this.evaluationContextProvider = createDefaultQueryMethodEvaluationContextProvider(
(ListableBeanFactory) beanFactory);
}
@@ -233,11 +233,13 @@ public abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>,
this.publisher = publisher;
}
@Override
@SuppressWarnings("unchecked")
public EntityInformation<S, ID> getEntityInformation() {
return (EntityInformation<S, ID>) factory.getEntityInformation(repositoryMetadata.getDomainType());
}
@Override
public RepositoryInformation getRepositoryInformation() {
RepositoryFragments fragments = customImplementation.map(RepositoryFragments::just)//
@@ -246,12 +248,14 @@ public abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>,
return factory.getRepositoryInformation(repositoryMetadata, fragments);
}
@Override
public PersistentEntity<?, ?> getPersistentEntity() {
return mappingContext.orElseThrow(() -> new IllegalStateException("No MappingContext available"))
.getRequiredPersistentEntity(repositoryMetadata.getDomainType());
}
@Override
public List<QueryMethod> getQueryMethods() {
return factory.getQueryMethods();
}

View File

@@ -318,7 +318,7 @@ public abstract class RepositoryFactorySupport implements BeanClassLoaderAware,
for (RepositoryFragment<?> fragment : composition.getFragments()) {
if (fragmentsTag.length() > 0) {
if (!fragmentsTag.isEmpty()) {
fragmentsTag.append(";");
}

View File

@@ -203,6 +203,7 @@ public interface RepositoryFragment<T> {
this.implementation = implementation;
}
@Override
public Class<?> getSignatureContributor() {
if (interfaceClass != null) {

View File

@@ -101,6 +101,7 @@ public abstract class TransactionalRepositoryFactoryBeanSupport<T extends Reposi
*/
protected abstract RepositoryFactorySupport doCreateRepositoryFactory();
@Override
public void setBeanFactory(BeanFactory beanFactory) {
Assert.isInstanceOf(ListableBeanFactory.class, beanFactory);

View File

@@ -66,6 +66,7 @@ class TransactionalRepositoryProxyPostProcessor implements RepositoryProxyPostPr
this.enableDefaultTransactions = enableDefaultTransaction;
}
@Override
public void postProcess(ProxyFactory factory, RepositoryInformation repositoryInformation) {
TransactionInterceptor transactionInterceptor = new TransactionInterceptor();

View File

@@ -78,6 +78,7 @@ public class Jackson2ResourceReader implements ResourceReader {
this.typeKey = typeKey == null ? DEFAULT_TYPE_KEY : typeKey;
}
@Override
public Object readFrom(Resource resource, @Nullable ClassLoader classLoader) throws Exception {
Assert.notNull(resource, "Resource must not be null");

View File

@@ -103,6 +103,7 @@ public class ResourceReaderRepositoryPopulator implements RepositoryPopulator, A
this.publisher = publisher;
}
@Override
public void populate(Repositories repositories) {
Assert.notNull(repositories, "Repositories must not be null");

View File

@@ -39,6 +39,7 @@ public class UnmarshallingResourceReader implements ResourceReader {
this.unmarshaller = unmarshaller;
}
@Override
public Object readFrom(Resource resource, @Nullable ClassLoader classLoader) throws IOException {
Assert.notNull(resource, "Resource must not be null");

View File

@@ -168,6 +168,7 @@ public class ParametersParameterAccessor implements ParameterAccessor {
*
* @return
*/
@Override
@Nullable
public Class<?> findDynamicProjection() {

View File

@@ -80,7 +80,7 @@ public abstract class QueryExecutionConverters {
QueryExecutionConverters.class.getClassLoader());
private static final Set<WrapperType> WRAPPER_TYPES = new HashSet<>(10, 1.0f);
private static final Set<WrapperType> UNWRAPPER_TYPES = new HashSet<WrapperType>(10, 1.0f);
private static final Set<WrapperType> UNWRAPPER_TYPES = new HashSet<>(10, 1.0f);
private static final Set<Function<Object, Object>> UNWRAPPERS = new HashSet<>();
private static final Set<Class<?>> ALLOWED_PAGEABLE_TYPES = new HashSet<>();
private static final Map<Class<?>, ExecutionAdapter> EXECUTION_ADAPTER = new HashMap<>(3, 1.0f);
@@ -442,7 +442,7 @@ public abstract class QueryExecutionConverters {
Streamable<Object> streamable = source == null //
? Streamable.empty() //
: Streamable.of(Iterable.class.cast(source));
: Streamable.of((Iterable) source);
return Streamable.class.equals(targetType.getType()) //
? streamable //

View File

@@ -278,6 +278,7 @@ public abstract class ReactiveWrapperConverters {
return Flux.class;
}
@Override
public Flux<?> map(Object wrapper, Function<Object, Object> function) {
return ((Flux<?>) wrapper).map(function);
}
@@ -297,6 +298,7 @@ public abstract class ReactiveWrapperConverters {
return Flow.class;
}
@Override
public Flow<?> map(Object wrapper, Function<Object, Object> function) {
return FlowKt.map((Flow<?>) wrapper, (o, continuation) -> function.apply(o));
}

View File

@@ -38,7 +38,7 @@ class MultiTransactionStatus implements TransactionStatus {
private final PlatformTransactionManager mainTransactionManager;
private final Map<PlatformTransactionManager, TransactionStatus> transactionStatuses = Collections
.synchronizedMap(new HashMap<PlatformTransactionManager, TransactionStatus>());
.synchronizedMap(new HashMap<>());
private boolean newSynchonization;

View File

@@ -28,14 +28,17 @@ enum SpringTransactionSynchronizationManager implements SynchronizationManager {
INSTANCE;
@Override
public void initSynchronization() {
TransactionSynchronizationManager.initSynchronization();
}
@Override
public boolean isSynchronizationActive() {
return TransactionSynchronizationManager.isSynchronizationActive();
}
@Override
public void clearSynchronization() {
TransactionSynchronizationManager.clear();
}

View File

@@ -34,7 +34,7 @@ final class LazyStreamable<T> implements Streamable<T> {
}
public static <T> LazyStreamable<T> of(Supplier<? extends Stream<T>> stream) {
return new LazyStreamable<T>(stream);
return new LazyStreamable<>(stream);
}
@Override

View File

@@ -99,7 +99,7 @@ public class MethodInvocationRecorder {
T proxy = (T) proxyFactory.getProxy(type.getClassLoader());
return new Recorded<T>(proxy, new MethodInvocationRecorder(Optional.ofNullable(interceptor)));
return new Recorded<>(proxy, new MethodInvocationRecorder(Optional.ofNullable(interceptor)));
}
private Optional<String> getPropertyPath(List<PropertyNameDetectionStrategy> strategies) {
@@ -319,7 +319,7 @@ public class MethodInvocationRecorder {
Assert.notNull(converter, "Function must not be null");
return new Recorded<S>(converter.apply(currentInstance), recorder);
return new Recorded<>(converter.apply(currentInstance), recorder);
}
/**
@@ -332,7 +332,7 @@ public class MethodInvocationRecorder {
Assert.notNull(converter, "Converter must not be null");
return new Recorded<S>(converter.apply(currentInstance).iterator().next(), recorder);
return new Recorded<>(converter.apply(currentInstance).iterator().next(), recorder);
}
/**
@@ -345,7 +345,7 @@ public class MethodInvocationRecorder {
Assert.notNull(converter, "Converter must not be null");
return new Recorded<S>(converter.apply(currentInstance).values().iterator().next(), recorder);
return new Recorded<>(converter.apply(currentInstance).values().iterator().next(), recorder);
}
@Override

View File

@@ -44,7 +44,7 @@ class MultiValueMapCollector<T, K, V> implements Collector<T, MultiValueMap<K, V
}
static <T, K, V> MultiValueMapCollector<T, K, V> of(Function<T, K> keyFunction, Function<T, V> valueFunction) {
return new MultiValueMapCollector<T, K, V>(keyFunction, valueFunction);
return new MultiValueMapCollector<>(keyFunction, valueFunction);
}
@Override

View File

@@ -64,9 +64,9 @@ public abstract class NullableWrapperConverters {
private static final boolean VAVR_PRESENT = ClassUtils.isPresent("io.vavr.control.Option",
NullableWrapperConverters.class.getClassLoader());
private static final Set<WrapperType> WRAPPER_TYPES = new HashSet<WrapperType>();
private static final Set<WrapperType> UNWRAPPER_TYPES = new HashSet<WrapperType>();
private static final Set<Converter<Object, Object>> UNWRAPPERS = new HashSet<Converter<Object, Object>>();
private static final Set<WrapperType> WRAPPER_TYPES = new HashSet<>();
private static final Set<WrapperType> UNWRAPPER_TYPES = new HashSet<>();
private static final Set<Converter<Object, Object>> UNWRAPPERS = new HashSet<>();
private static final Map<Class<?>, Boolean> supportsCache = new ConcurrentReferenceHashMap<>();
static {
@@ -410,7 +410,7 @@ public abstract class NullableWrapperConverters {
INSTANCE;
private final Function0<Object> alternative = new AbstractFunction0<Object>() {
private final Function0<Object> alternative = new AbstractFunction0<>() {
@Nullable
@Override

View File

@@ -125,6 +125,7 @@ public final class ReflectionUtils {
return AnnotationUtils.getAnnotation(field, annotationType) != null;
}
@Override
public String getDescription() {
return String.format("Annotation filter for %s", annotationType.getName());
}
@@ -146,6 +147,7 @@ public final class ReflectionUtils {
return filter.matches(field);
}
@Override
public String getDescription() {
return String.format("FieldFilter %s", filter.toString());
}

View File

@@ -135,14 +135,14 @@ public interface StreamUtils {
int characteristics = lefts.characteristics() & rights.characteristics();
boolean parallel = left.isParallel() || right.isParallel();
return StreamSupport.stream(new AbstractSpliterator<T>(size, characteristics) {
return StreamSupport.stream(new AbstractSpliterator<>(size, characteristics) {
@Override
@SuppressWarnings("null")
public boolean tryAdvance(Consumer<? super T> action) {
Sink<L> leftSink = new Sink<L>();
Sink<R> rightSink = new Sink<R>();
Sink<L> leftSink = new Sink<>();
Sink<R> rightSink = new Sink<>();
boolean leftAdvance = lefts.tryAdvance(leftSink);

View File

@@ -152,7 +152,7 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
List<TypeInformation<?>> arguments = getTypeArguments();
if (arguments.size() > 0) {
if (!arguments.isEmpty()) {
return arguments.get(0);
}

View File

@@ -224,6 +224,7 @@ public class TypeUtils {
this.type = type;
}
@Override
public Class<?> getType() {
return type;
}

View File

@@ -97,7 +97,7 @@ public class JsonProjectingMethodInterceptorFactory implements MethodInterceptor
@Override
public MethodInterceptor createMethodInterceptor(Object source, Class<?> targetType) {
DocumentContext context = InputStream.class.isInstance(source) ? this.context.parse((InputStream) source)
DocumentContext context = source instanceof InputStream ? this.context.parse((InputStream) source)
: this.context.parse(source);
return new InputMessageProjecting(context);
@@ -106,12 +106,11 @@ public class JsonProjectingMethodInterceptorFactory implements MethodInterceptor
@Override
public boolean supports(Object source, Class<?> targetType) {
if (InputStream.class.isInstance(source) || JSONObject.class.isInstance(source)
|| JSONArray.class.isInstance(source)) {
if (source instanceof InputStream || source instanceof JSONObject || source instanceof JSONArray) {
return true;
}
return Map.class.isInstance(source) && hasJsonPathAnnotation(targetType);
return source instanceof Map && hasJsonPathAnnotation(targetType);
}
/**

View File

@@ -173,8 +173,8 @@ abstract class SpringDataAnnotationUtils {
private static Qualifier findAnnotation(Annotation[] annotations) {
for (Annotation annotation : annotations) {
if (annotation instanceof Qualifier) {
return (Qualifier) annotation;
if (annotation instanceof Qualifier q) {
return q;
}
}

View File

@@ -120,7 +120,7 @@ public class XmlBeamHttpMessageConverter extends AbstractHttpMessageConverter<Ob
Throwable cause = o_O.getCause();
if (SAXParseException.class.isInstance(cause)) {
if (cause instanceof SAXParseException) {
throw new HttpMessageNotReadableException("Cannot read input message", cause, inputMessage);
} else {
throw o_O;

View File

@@ -103,7 +103,7 @@ public class ProjectingArgumentResolverRegistrar {
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (!RequestMappingHandlerAdapter.class.isInstance(bean)) {
if (!(bean instanceof RequestMappingHandlerAdapter)) {
return bean;
}
@@ -115,7 +115,7 @@ public class ProjectingArgumentResolverRegistrar {
String.format("No HandlerMethodArgumentResolvers found in RequestMappingHandlerAdapter %s", beanName));
}
List<HandlerMethodArgumentResolver> newResolvers = new ArrayList<HandlerMethodArgumentResolver>(
List<HandlerMethodArgumentResolver> newResolvers = new ArrayList<>(
currentResolvers.size() + 1);
newResolvers.add(resolver);
newResolvers.addAll(currentResolvers);

View File

@@ -131,7 +131,7 @@ public class SpringDataWebConfiguration implements WebMvcConfigurer, BeanClassLo
return;
}
DomainClassConverter<FormattingConversionService> converter = new DomainClassConverter<FormattingConversionService>(
DomainClassConverter<FormattingConversionService> converter = new DomainClassConverter<>(
conversionService);
converter.setApplicationContext(context);
}

View File

@@ -44,6 +44,7 @@ public class ConfigWithCustomRepositoryBaseClass {
return this.delegate.save(entity);
}
@Override
public <S extends T> Iterable<S> saveAll(Iterable<S> entities) {
return this.delegate.saveAll(entities);
}
@@ -52,38 +53,47 @@ public class ConfigWithCustomRepositoryBaseClass {
return this.delegate.findById(id);
}
@Override
public boolean existsById(ID id) {
return this.delegate.existsById(id);
}
@Override
public Iterable<T> findAll() {
return this.delegate.findAll();
}
@Override
public Iterable<T> findAllById(Iterable<ID> ids) {
return this.delegate.findAllById(ids);
}
@Override
public long count() {
return this.delegate.count();
}
@Override
public void deleteById(ID id) {
this.delegate.deleteById(id);
}
@Override
public void delete(T entity) {
this.delegate.delete(entity);
}
@Override
public void deleteAllById(Iterable<? extends ID> ids) {
this.delegate.deleteAllById(ids);
}
@Override
public void deleteAll(Iterable<? extends T> entities) {
this.delegate.deleteAll(entities);
}
@Override
public void deleteAll() {
this.delegate.deleteAll();
}

View File

@@ -44,34 +44,42 @@ class AuditedUser implements Auditable<AuditedUser, Long, LocalDateTime> {
return id == null;
}
@Override
public Optional<AuditedUser> getCreatedBy() {
return Optional.ofNullable(createdBy);
}
@Override
public void setCreatedBy(AuditedUser createdBy) {
this.createdBy = createdBy;
}
@Override
public Optional<LocalDateTime> getCreatedDate() {
return Optional.ofNullable(createdDate);
}
@Override
public void setCreatedDate(LocalDateTime creationDate) {
this.createdDate = creationDate;
}
@Override
public Optional<AuditedUser> getLastModifiedBy() {
return Optional.ofNullable(modifiedBy);
}
@Override
public void setLastModifiedBy(AuditedUser lastModifiedBy) {
this.modifiedBy = lastModifiedBy;
}
@Override
public Optional<LocalDateTime> getLastModifiedDate() {
return Optional.ofNullable(modifiedDate);
}
@Override
public void setLastModifiedDate(LocalDateTime lastModifiedDate) {
this.modifiedDate = lastModifiedDate;
}

View File

@@ -90,18 +90,22 @@ class AuditingBeanDefinitionRegistrarSupportUnitTests {
protected AuditingConfiguration getConfiguration(AnnotationMetadata annotationMetadata) {
return new AuditingConfiguration() {
@Override
public String getAuditorAwareRef() {
return "auditor";
}
@Override
public boolean isSetDates() {
return true;
}
@Override
public String getDateTimeProviderRef() {
return "dateTimeProvider";
}
@Override
public boolean isModifyOnCreate() {
return true;
}

View File

@@ -358,10 +358,12 @@ public class AbstractPersistentPropertyUnitTests {
super(property, owner, simpleTypeHolder);
}
@Override
public boolean isIdProperty() {
return false;
}
@Override
public boolean isVersionProperty() {
return false;
}

View File

@@ -129,6 +129,7 @@ class QuerydslBindingsFactoryUnitTests {
static class SpecificBinding implements QuerydslBinderCustomizer<QUser> {
@Override
public void customize(QuerydslBindings bindings, QUser user) {
bindings.bind(user.firstname).firstOptional((path, value) -> value.map(it -> path.eq(it.toUpperCase())));

View File

@@ -94,10 +94,12 @@ class DefaultRepositoryConfigurationUnitTests {
this.modulePrefix = modulePrefix;
}
@Override
public String getRepositoryFactoryBeanClassName() {
return this.repositoryFactoryBeanClassName;
}
@Override
public String getModulePrefix() {
return this.modulePrefix;
}

View File

@@ -23,6 +23,7 @@ import org.springframework.data.repository.core.support.DummyRepositoryFactoryBe
*/
class DummyConfigurationExtension extends RepositoryConfigurationExtensionSupport {
@Override
public String getRepositoryFactoryBeanClassName() {
return DummyRepositoryFactoryBean.class.getName();
}

View File

@@ -24,6 +24,7 @@ import org.springframework.data.repository.core.support.ReactiveDummyRepositoryF
*/
class ReactiveDummyConfigurationExtension extends RepositoryConfigurationExtensionSupport {
@Override
public String getRepositoryFactoryBeanClassName() {
return ReactiveDummyRepositoryFactoryBean.class.getName();
}

View File

@@ -184,6 +184,7 @@ class RepositoryBeanDefinitionRegistrarSupportUnitTests {
static class DummyConfigurationExtension extends RepositoryConfigurationExtensionSupport {
@Override
public String getRepositoryFactoryBeanClassName() {
return DummyRepositoryFactoryBean.class.getName();
}

View File

@@ -324,6 +324,7 @@ class RepositoryConfigurationDelegateUnitTests {
static class DummyConfigurationExtension extends RepositoryConfigurationExtensionSupport {
@Override
public String getRepositoryFactoryBeanClassName() {
return DummyRepositoryFactoryBean.class.getName();
}

View File

@@ -238,10 +238,12 @@ class DefaultCrudMethodsUnitTests {
// DATACMNS-393
interface RepositoryWithAllCrudMethodOverloaded extends CrudRepository<Domain, Long> {
@Override
List<Domain> findAll();
<S extends Domain> S save(S entity);
@Override
void deleteById(Long id);
Optional<Domain> findById(Long id);
@@ -262,6 +264,7 @@ class DefaultCrudMethodsUnitTests {
// DATACMNS-539
interface RepositoryWithDeleteMethodForEntityOverloaded extends CrudRepository<Domain, Long> {
@Override
void delete(Domain entity);
}
}

View File

@@ -334,6 +334,7 @@ class DefaultRepositoryInformationUnitTests {
<K extends S> K save(K entity);
@Override
void delete(S entity);
@MyQuery
@@ -371,6 +372,7 @@ class DefaultRepositoryInformationUnitTests {
interface CustomDefaultRepositoryMethodsRepository extends CrudRepository<User, Integer> {
@Override
@MyQuery
List<User> findAll();
}
@@ -402,6 +404,7 @@ class DefaultRepositoryInformationUnitTests {
return this.delegate.save(entity);
}
@Override
public <S extends T> Iterable<S> saveAll(Iterable<S> entities) {
return this.delegate.saveAll(entities);
}
@@ -410,38 +413,47 @@ class DefaultRepositoryInformationUnitTests {
return this.delegate.findById(id);
}
@Override
public boolean existsById(ID id) {
return this.delegate.existsById(id);
}
@Override
public Iterable<T> findAll() {
return this.delegate.findAll();
}
@Override
public Iterable<T> findAllById(Iterable<ID> ids) {
return this.delegate.findAllById(ids);
}
@Override
public long count() {
return this.delegate.count();
}
@Override
public void deleteById(ID id) {
this.delegate.deleteById(id);
}
@Override
public void delete(T entity) {
this.delegate.delete(entity);
}
@Override
public void deleteAllById(Iterable<? extends ID> ids) {
this.delegate.deleteAllById(ids);
}
@Override
public void deleteAll(Iterable<? extends T> entities) {
this.delegate.deleteAll(entities);
}
@Override
public void deleteAll() {
this.delegate.deleteAll();
}

View File

@@ -33,10 +33,12 @@ public class DummyEntityInformation<T> extends AbstractEntityInformation<T, Seri
super(domainClass);
}
@Override
public Serializable getId(Object entity) {
return entity == null ? null : entity.toString();
}
@Override
public Class<Serializable> getIdType() {
return Serializable.class;
}

View File

@@ -37,14 +37,17 @@ public final class DummyRepositoryInformation implements RepositoryInformation {
this.metadata = metadata;
}
@Override
public TypeInformation<?> getIdTypeInformation() {
return metadata.getIdTypeInformation();
}
@Override
public TypeInformation<?> getDomainTypeInformation() {
return metadata.getDomainTypeInformation();
}
@Override
public Class<?> getRepositoryInterface() {
return metadata.getRepositoryInterface();
}
@@ -54,38 +57,47 @@ public final class DummyRepositoryInformation implements RepositoryInformation {
return metadata.getReturnType(method);
}
@Override
public Class<?> getReturnedDomainClass(Method method) {
return getDomainType();
}
@Override
public Class<?> getRepositoryBaseClass() {
return getRepositoryInterface();
}
@Override
public boolean hasCustomMethod() {
return false;
}
@Override
public boolean isCustomMethod(Method method) {
return false;
}
@Override
public boolean isQueryMethod(Method method) {
return false;
}
@Override
public Streamable<Method> getQueryMethods() {
return Streamable.empty();
}
@Override
public Method getTargetClassMethod(Method method) {
return method;
}
@Override
public boolean isBaseClassMethod(Method method) {
return true;
}
@Override
public CrudMethods getCrudMethods() {
return new DefaultCrudMethods(this);
}

View File

@@ -174,6 +174,7 @@ class CrudRepositoryInvokerUnitTests {
interface CrudWithRedeclaredDelete extends CrudRepository<Order, Long> {
@Override
void deleteById(Long id);
}
}

View File

@@ -279,19 +279,23 @@ class RepositoriesUnitTests {
this.mappingContext = new SampleMappingContext();
}
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public EntityInformation<T, S> getEntityInformation() {
return new DummyEntityInformation(repositoryMetadata.getDomainType());
}
@Override
public RepositoryInformation getRepositoryInformation() {
return new DummyRepositoryInformation(repositoryMetadata);
}
@Override
public PersistentEntity<?, ?> getPersistentEntity() {
return mappingContext.getRequiredPersistentEntity(repositoryMetadata.getDomainType());
}
@Override
public List<QueryMethod> getQueryMethods() {
return Collections.emptyList();
}

View File

@@ -137,14 +137,17 @@ class ChainedTransactionManagerTests {
private boolean synchronizationActive;
@Override
public void initSynchronization() {
synchronizationActive = true;
}
@Override
public boolean isSynchronizationActive() {
return synchronizationActive;
}
@Override
public void clearSynchronization() {
synchronizationActive = false;
}

View File

@@ -178,6 +178,7 @@ class ReflectionUtilsUnitTests {
return field.getName().equals(name);
}
@Override
public String getDescription() {
return String.format("Filter for fields named %s", name);
}

View File

@@ -273,6 +273,7 @@ class QuerydslPredicateArgumentResolverUnitTests {
static class SpecificBinding implements QuerydslBinderCustomizer<QUser> {
@Override
public void customize(QuerydslBindings bindings, QUser user) {
bindings.bind(user.firstname).firstOptional((path, value) -> value.map(it -> path.eq(it.toUpperCase())));

View File

@@ -142,6 +142,7 @@ class ReactiveQuerydslPredicateArgumentResolverUnitTests {
static class SpecificBinding implements QuerydslBinderCustomizer<QUser> {
@Override
public void customize(QuerydslBindings bindings, QUser user) {
bindings.bind(user.firstname).firstOptional((path, value) -> value.map(it -> path.eq(it.toUpperCase())));