DATACMNS-387 - Improvements in null handling in PartTree area.
We're now rejecting invalid constructor arguments handed to ClassTypeInformation, Part, PartTree and PropertyPath. Beyond that we skip the creation of a Part for an empty path segment, so that you don't end up with an invalid Part instance for a findAllByOrderByFooAsc.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2012 the original author or authors.
|
||||
* Copyright 2011-2013 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.
|
||||
@@ -53,7 +53,6 @@ public class PropertyPath implements Iterable<PropertyPath> {
|
||||
* @param owningType must not be {@literal null}.
|
||||
*/
|
||||
PropertyPath(String name, Class<?> owningType) {
|
||||
|
||||
this(name, ClassTypeInformation.from(owningType), null);
|
||||
}
|
||||
|
||||
@@ -133,7 +132,6 @@ public class PropertyPath implements Iterable<PropertyPath> {
|
||||
* @see #hasNext()
|
||||
*/
|
||||
public PropertyPath next() {
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
@@ -144,7 +142,6 @@ public class PropertyPath implements Iterable<PropertyPath> {
|
||||
* @return
|
||||
*/
|
||||
public boolean hasNext() {
|
||||
|
||||
return next != null;
|
||||
}
|
||||
|
||||
@@ -168,7 +165,6 @@ public class PropertyPath implements Iterable<PropertyPath> {
|
||||
* @return
|
||||
*/
|
||||
public boolean isCollection() {
|
||||
|
||||
return isCollection;
|
||||
}
|
||||
|
||||
@@ -242,7 +238,6 @@ public class PropertyPath implements Iterable<PropertyPath> {
|
||||
* @return
|
||||
*/
|
||||
public static PropertyPath from(String source, Class<?> type) {
|
||||
|
||||
return from(source, ClassTypeInformation.from(type));
|
||||
}
|
||||
|
||||
@@ -255,6 +250,9 @@ public class PropertyPath implements Iterable<PropertyPath> {
|
||||
*/
|
||||
public static PropertyPath from(String source, TypeInformation<?> type) {
|
||||
|
||||
Assert.hasText(source, "Source must not be null or empty!");
|
||||
Assert.notNull(type, "TypeInformation must not be null or empty!");
|
||||
|
||||
List<String> iteratorSource = new ArrayList<String>();
|
||||
Matcher matcher = SPLITTER.matcher("_" + source);
|
||||
|
||||
@@ -306,7 +304,6 @@ public class PropertyPath implements Iterable<PropertyPath> {
|
||||
* @return
|
||||
*/
|
||||
private static PropertyPath create(String source, TypeInformation<?> type, Stack<PropertyPath> base) {
|
||||
|
||||
return create(source, type, "", base);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user