Polishing.
Pattern matching usage. Diamond operator usage. Remove unused import. isEmpty usage. Original pull request #1912
This commit is contained in:
committed by
Jens Schauder
parent
a8463e0ca6
commit
f2d62ad7e7
@@ -41,12 +41,12 @@ class IterableOfEntryToMapConverter implements ConditionalConverter, Converter<I
|
||||
|
||||
source.forEach(element -> {
|
||||
|
||||
if (!(element instanceof Entry)) {
|
||||
throw new IllegalArgumentException(String.format("Cannot convert %s to Map.Entry", element.getClass()));
|
||||
if (element instanceof Entry entry) {
|
||||
result.put(entry.getKey(), entry.getValue());
|
||||
return;
|
||||
}
|
||||
|
||||
Entry entry = (Entry) element;
|
||||
result.put(entry.getKey(), entry.getValue());
|
||||
throw new IllegalArgumentException(String.format("Cannot convert %s to Map.Entry", element.getClass()));
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.time.LocalDateTime;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.temporal.Temporal;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package org.springframework.data.jdbc.core.convert;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.AggregatePath;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -296,7 +296,7 @@ public class QueryMapper {
|
||||
&& metadataBackedField.property != null //
|
||||
&& (criteria.getValue() == null || !criteria.getValue().getClass().isArray())) {
|
||||
|
||||
RelationalPersistentProperty property = ((MetadataBackedField) propertyField).property;
|
||||
RelationalPersistentProperty property = metadataBackedField.property;
|
||||
JdbcValue jdbcValue = convertToJdbcValue(property, criteria.getValue());
|
||||
mappedValue = jdbcValue.getValue();
|
||||
sqlType = jdbcValue.getJdbcType() != null ? jdbcValue.getJdbcType() : propertyField.getSqlType();
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.springframework.data.mapping.model.Property;
|
||||
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
||||
import org.springframework.data.relational.core.mapping.BasicRelationalPersistentProperty;
|
||||
import org.springframework.data.relational.core.mapping.NamingStrategy;
|
||||
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.jdbc.core.mapping;
|
||||
|
||||
import org.springframework.data.mapping.InstanceCreatorMetadata;
|
||||
import org.springframework.data.mapping.Parameter;
|
||||
import org.springframework.data.mapping.context.MappingContext;
|
||||
import org.springframework.data.mapping.model.Property;
|
||||
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
||||
@@ -25,8 +23,6 @@ import org.springframework.data.relational.core.mapping.RelationalMappingContext
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link MappingContext} implementation for JDBC.
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.FluentQuery;
|
||||
import org.springframework.data.repository.query.QueryByExampleExecutor;
|
||||
import org.springframework.data.util.Streamable;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user