From f96dc0817aa834e9572f376ffa0de013d5480cda Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 25 Aug 2011 19:42:04 +0100 Subject: [PATCH] DATACMNS-66 - Polishing. Removed Part.shouldAlwaysIgnoreCase() and don't constraint Part.shouldIgnoreCase() to String parts anymore. --- .../data/repository/query/parser/Part.java | 7 +------ .../data/repository/query/parser/PartTree.java | 16 +--------------- .../query/parser/PartTreeUnitTests.java | 9 --------- 3 files changed, 2 insertions(+), 30 deletions(-) diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Part.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Part.java index acfaaa6ef..16a8a1235 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Part.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Part.java @@ -114,10 +114,6 @@ public class Part { */ public boolean shouldIgnoreCase() { - if (!String.class.equals(getProperty().getType())) { - return false; - } - return ignoreCase; } @@ -207,8 +203,7 @@ public class Part { /** * Creates a new {@link Type} using the given keyword, number of arguments to be bound and operator. Keyword and * operator can be {@literal null}. - * - * @param operator + * * @param numberOfArguments * @param keywords */ diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/PartTree.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/PartTree.java index d3e0b9929..d5a18e015 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/PartTree.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/PartTree.java @@ -116,16 +116,6 @@ public class PartTree implements Iterable { return result; } - /** - * Returns true if all String based selections should not consider sentence case. - * - * @return true if case is ignored - */ - public boolean shouldAlwaysIgnoreCase() { - - return predicate.shouldAlwaysIgnoreCase(); - } - @Override public String toString() { @@ -140,7 +130,7 @@ public class PartTree implements Iterable { * * @param text the text to split * @param keyword the keyword to split around - * @return an arry of split items + * @return an array of split items */ private static String[] split(String text, String keyword) { @@ -259,9 +249,5 @@ public class PartTree implements Iterable { public OrderBySource getOrderBySource() { return orderBySource; } - - public boolean shouldAlwaysIgnoreCase() { - return alwaysIgnoreCase; - } } } diff --git a/spring-data-commons-core/src/test/java/org/springframework/data/repository/query/parser/PartTreeUnitTests.java b/spring-data-commons-core/src/test/java/org/springframework/data/repository/query/parser/PartTreeUnitTests.java index 62827c945..45bef5ce7 100644 --- a/spring-data-commons-core/src/test/java/org/springframework/data/repository/query/parser/PartTreeUnitTests.java +++ b/spring-data-commons-core/src/test/java/org/springframework/data/repository/query/parser/PartTreeUnitTests.java @@ -160,7 +160,6 @@ public class PartTreeUnitTests { private void detectsIgnoreAllCase(String source, boolean expected) throws Exception { PartTree tree = partTree(source); - assertThat(tree.shouldAlwaysIgnoreCase(), is(expected)); for (Part part : tree.getParts()) { assertThat(part.shouldIgnoreCase(), is(expected)); } @@ -184,14 +183,6 @@ public class PartTreeUnitTests { assertThat(parts.next().shouldIgnoreCase(), is(false)); } - @Test - public void doesNotIgnoreCaseIfNotStringProperty() throws Exception { - PartTree tree = partTree("findByLocationIgnoringCase"); - assertPart(tree, parts("location")); - Iterator parts = tree.getParts().iterator(); - assertThat(parts.next().shouldIgnoreCase(), is(false)); - } - private PartTree partTree(String source) { return new PartTree(source, User.class); }