DATACMNS-558 - Some code cleanups according to the Sonar report.

This commit is contained in:
Oliver Gierke
2014-08-09 11:55:46 +02:00
parent 756c951112
commit 3660676338
15 changed files with 60 additions and 55 deletions

View File

@@ -175,10 +175,10 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
propertyCache.put(property.getName(), property);
}
P idProperty = returnPropertyIfBetterIdPropertyCandidateOrNull(property);
P candidate = returnPropertyIfBetterIdPropertyCandidateOrNull(property);
if (idProperty != null) {
this.idProperty = idProperty;
if (candidate != null) {
this.idProperty = candidate;
}
if (property.isVersionProperty()) {

View File

@@ -69,9 +69,9 @@ public class PreferredConstructorDiscoverer<T, P extends PersistentProperty<P>>
int numberOfArgConstructors = 0;
Class<?> rawOwningType = type.getType();
for (Constructor<?> constructor : rawOwningType.getDeclaredConstructors()) {
for (Constructor<?> candidate : rawOwningType.getDeclaredConstructors()) {
PreferredConstructor<T, P> preferredConstructor = buildPreferredConstructor(constructor, type, entity);
PreferredConstructor<T, P> preferredConstructor = buildPreferredConstructor(candidate, type, entity);
// Explicitly defined constructor trumps all
if (preferredConstructor.isExplicitlyAnnotated()) {

View File

@@ -115,15 +115,19 @@ public class SimpleTypeHolder {
* @return
*/
public boolean isSimpleType(Class<?> type) {
Assert.notNull(type);
if (Object.class.equals(type)) {
return true;
}
for (Class<?> clazz : simpleTypes) {
if (type == clazz || clazz.isAssignableFrom(type)) {
if (clazz.isAssignableFrom(type)) {
return true;
}
}
return false;
}
}