DATACMNS-601 - Fixes for most of the SonarQube warnings.
This commit is contained in:
@@ -15,9 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.mapping;
|
||||
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.mapping.model.MappingException;
|
||||
|
||||
/**
|
||||
* Domain service to allow accessing and setting {@link PersistentProperty}s of an entity.
|
||||
*
|
||||
@@ -27,11 +24,12 @@ public interface PersistentPropertyAccessor {
|
||||
|
||||
/**
|
||||
* Sets the given {@link PersistentProperty} to the given value. Will do type conversion if a
|
||||
* {@link ConversionService} is configured.
|
||||
* {@link org.springframework.core.convert.ConversionService} is configured.
|
||||
*
|
||||
* @param property must not be {@literal null}.
|
||||
* @param value can be {@literal null}.
|
||||
* @throws MappingException in case an exception occurred when setting the property value.
|
||||
* @throws org.springframework.data.mapping.model.MappingException in case an exception occurred when setting the
|
||||
* property value.
|
||||
*/
|
||||
void setProperty(PersistentProperty<?> property, Object value);
|
||||
|
||||
|
||||
@@ -69,15 +69,15 @@ public class PropertyPath implements Iterable<PropertyPath> {
|
||||
Assert.notNull(owningType);
|
||||
|
||||
String propertyName = name.matches(ALL_UPPERCASE) ? name : StringUtils.uncapitalize(name);
|
||||
TypeInformation<?> type = owningType.getProperty(propertyName);
|
||||
TypeInformation<?> propertyType = owningType.getProperty(propertyName);
|
||||
|
||||
if (type == null) {
|
||||
if (propertyType == null) {
|
||||
throw new PropertyReferenceException(propertyName, owningType, base);
|
||||
}
|
||||
|
||||
this.owningType = owningType;
|
||||
this.isCollection = type.isCollectionLike();
|
||||
this.type = type.getActualType();
|
||||
this.isCollection = propertyType.isCollectionLike();
|
||||
this.type = propertyType.getActualType();
|
||||
this.name = propertyName;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ class DefaultPersistentPropertyPath<T extends PersistentProperty<T>> implements
|
||||
return this;
|
||||
}
|
||||
|
||||
List<T> properties = new ArrayList<T>();
|
||||
List<T> result = new ArrayList<T>();
|
||||
Iterator<T> iterator = iterator();
|
||||
|
||||
for (int i = 0; i < base.getLength(); i++) {
|
||||
@@ -166,10 +166,10 @@ class DefaultPersistentPropertyPath<T extends PersistentProperty<T>> implements
|
||||
}
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
properties.add(iterator.next());
|
||||
result.add(iterator.next());
|
||||
}
|
||||
|
||||
return new DefaultPersistentPropertyPath<T>(properties);
|
||||
return new DefaultPersistentPropertyPath<T>(result);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -158,9 +158,10 @@ public abstract class AnnotationBasedPersistentProperty<P extends PersistentProp
|
||||
@Override
|
||||
public boolean isTransient() {
|
||||
|
||||
if (isTransient == null) {
|
||||
boolean isTransient = super.isTransient() || isAnnotationPresent(Transient.class);
|
||||
this.isTransient = isTransient || isAnnotationPresent(Value.class) || isAnnotationPresent(Autowired.class);
|
||||
if (this.isTransient == null) {
|
||||
boolean potentiallyTransient = super.isTransient() || isAnnotationPresent(Transient.class);
|
||||
this.isTransient = potentiallyTransient || isAnnotationPresent(Value.class)
|
||||
|| isAnnotationPresent(Autowired.class);
|
||||
}
|
||||
|
||||
return this.isTransient;
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.mapping.PersistentEntity;
|
||||
import org.springframework.data.mapping.PersistentProperty;
|
||||
import org.springframework.data.mapping.PersistentPropertyAccessor;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -40,7 +39,8 @@ public class BeanWrapper<T> implements PersistentPropertyAccessor {
|
||||
* @param bean must not be {@literal null}.
|
||||
* @param conversionService can be {@literal null}.
|
||||
* @return
|
||||
* @deprecated use {@link PersistentEntity#getPropertyAccessor(Object)} instead. Will be removed in 1.10 RC1.
|
||||
* @deprecated use {@link org.springframework.data.mapping.PersistentEntity#getPropertyAccessor(Object)} instead. Will
|
||||
* be removed in 1.10 RC1.
|
||||
*/
|
||||
@Deprecated
|
||||
public static <T> BeanWrapper<T> create(T bean, ConversionService conversionService) {
|
||||
|
||||
Reference in New Issue
Block a user