diff --git a/.gitignore b/.gitignore
index c9bac95a6..5f3a48c09 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ src/ant/.ant-targets-upload-dist.xml
*.ipr
*.iws
/.idea/
+*.graphml
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 6d7dcc5d0..58e2155a4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -261,6 +261,12 @@
true
+
+ de.schauderhaft.degraph
+ degraph-check
+ 0.1.4
+
+
diff --git a/src/main/java/org/springframework/data/domain/ExampleMatcher.java b/src/main/java/org/springframework/data/domain/ExampleMatcher.java
index ff7b27b15..f61e96a14 100644
--- a/src/main/java/org/springframework/data/domain/ExampleMatcher.java
+++ b/src/main/java/org/springframework/data/domain/ExampleMatcher.java
@@ -46,6 +46,7 @@ import org.springframework.util.Assert;
* @author Christoph Strobl
* @author Mark Paluch
* @author Oliver Gierke
+ * @author Jens Schauder
* @param
* @since 1.12
*/
@@ -635,8 +636,9 @@ public class ExampleMatcher {
* Match modes for treatment of {@link String} values.
*
* @author Christoph Strobl
+ * @author Jens Schauder
*/
- public static enum StringMatcher {
+ public enum StringMatcher {
/**
* Store specific default.
diff --git a/src/main/java/org/springframework/data/repository/core/support/ExampleMatcherAccessor.java b/src/main/java/org/springframework/data/repository/core/support/ExampleMatcherAccessor.java
index 3cefbb6db..55a29217d 100644
--- a/src/main/java/org/springframework/data/repository/core/support/ExampleMatcherAccessor.java
+++ b/src/main/java/org/springframework/data/repository/core/support/ExampleMatcherAccessor.java
@@ -15,11 +15,7 @@
*/
package org.springframework.data.repository.core.support;
-import java.util.Collection;
-
import org.springframework.data.domain.ExampleMatcher;
-import org.springframework.data.domain.ExampleMatcher.PropertySpecifier;
-import org.springframework.util.Assert;
/**
* Accessor for the {@link ExampleMatcher} to use in modules that support query by example (QBE) querying.
@@ -27,139 +23,22 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @author Oliver Gierke
* @author Christoph Strobl
+ * @author Jens Schauder
+ *
* @since 1.12
+ *
+ * @deprecated use {@link org.springframework.data.support.ExampleMatcherAccessor} instead.
*/
-public class ExampleMatcherAccessor {
+@Deprecated
+public class ExampleMatcherAccessor extends org.springframework.data.support.ExampleMatcherAccessor {
- private final ExampleMatcher matcher;
/**
* Creates a new {@link ExampleMatcherAccessor} for the given {@link ExampleMatcher}.
- *
+ *
* @param matcher must not be {@literal null}.
*/
public ExampleMatcherAccessor(ExampleMatcher matcher) {
-
- Assert.notNull(matcher, "ExampleMatcher must not be null!");
-
- this.matcher = matcher;
- }
-
- /**
- * Returns the {@link PropertySpecifier}s of the underlying {@link ExampleMatcher}.
- *
- * @return unmodifiable {@link Collection} of {@link ExampleMatcher.PropertySpecifier}s.
- */
- public Collection getPropertySpecifiers() {
- return matcher.getPropertySpecifiers().getSpecifiers();
- }
-
- /**
- * Returns whether the underlying {@link ExampleMatcher} contains a {@link PropertySpecifier} for the given path.
- *
- * @param path the dot-path identifying a property.
- * @return {@literal true} in case {@link ExampleMatcher.PropertySpecifier} defined for given path.
- */
- public boolean hasPropertySpecifier(String path) {
- return matcher.getPropertySpecifiers().hasSpecifierForPath(path);
- }
-
- /**
- * Get the {@link ExampleMatcher.PropertySpecifier} for given path.
- * Please check if {@link #hasPropertySpecifier(String)} to avoid running into {@literal null} values.
- *
- * @param path Dot-Path to property.
- * @return {@literal null} when no {@link ExampleMatcher.PropertySpecifier} defined for path.
- */
- public ExampleMatcher.PropertySpecifier getPropertySpecifier(String path) {
- return matcher.getPropertySpecifiers().getForPath(path);
- }
-
- /**
- * @return true if at least one {@link ExampleMatcher.PropertySpecifier} defined.
- */
- public boolean hasPropertySpecifiers() {
- return matcher.getPropertySpecifiers().hasValues();
- }
-
- /**
- * Get the {@link ExampleMatcher.StringMatcher} for a given path or return the default one if none defined.
- *
- * @param path
- * @return never {@literal null}.
- */
- public ExampleMatcher.StringMatcher getStringMatcherForPath(String path) {
-
- if (!hasPropertySpecifier(path)) {
- return matcher.getDefaultStringMatcher();
- }
-
- ExampleMatcher.PropertySpecifier specifier = getPropertySpecifier(path);
- return specifier.getStringMatcher() != null ? specifier.getStringMatcher() : matcher.getDefaultStringMatcher();
- }
-
- /**
- * Get defined null handling.
- *
- * @return never {@literal null}
- */
- public ExampleMatcher.NullHandler getNullHandler() {
- return matcher.getNullHandler();
- }
-
- /**
- * Get defined {@link ExampleMatcher.StringMatcher}.
- *
- * @return never {@literal null}.
- */
- public ExampleMatcher.StringMatcher getDefaultStringMatcher() {
- return matcher.getDefaultStringMatcher();
- }
-
- /**
- * @return {@literal true} if {@link String} should be matched with ignore case option.
- */
- public boolean isIgnoreCaseEnabled() {
- return matcher.isIgnoreCaseEnabled();
- }
-
- /**
- * @param path
- * @return return {@literal true} if path was set to be ignored.
- */
- public boolean isIgnoredPath(String path) {
- return matcher.isIgnoredPath(path);
- }
-
- /**
- * Get the ignore case flag for a given path or return the default one if none defined.
- *
- * @param path
- * @return never {@literal null}.
- */
- public boolean isIgnoreCaseForPath(String path) {
-
- if (!hasPropertySpecifier(path)) {
- return matcher.isIgnoreCaseEnabled();
- }
-
- ExampleMatcher.PropertySpecifier specifier = getPropertySpecifier(path);
- return specifier.getIgnoreCase() != null ? specifier.getIgnoreCase() : matcher.isIgnoreCaseEnabled();
- }
-
- /**
- * Get the ignore case flag for a given path or return {@link ExampleMatcher.NoOpPropertyValueTransformer} if none
- * defined.
- *
- * @param path
- * @return never {@literal null}.
- */
- public ExampleMatcher.PropertyValueTransformer getValueTransformerForPath(String path) {
-
- if (!hasPropertySpecifier(path)) {
- return ExampleMatcher.NoOpPropertyValueTransformer.INSTANCE;
- }
-
- return getPropertySpecifier(path).getPropertyValueTransformer();
+ super(matcher);
}
}
diff --git a/src/main/java/org/springframework/data/support/ExampleMatcherAccessor.java b/src/main/java/org/springframework/data/support/ExampleMatcherAccessor.java
new file mode 100644
index 000000000..80f699082
--- /dev/null
+++ b/src/main/java/org/springframework/data/support/ExampleMatcherAccessor.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2016-2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.data.support;
+
+import java.util.Collection;
+
+import org.springframework.data.domain.ExampleMatcher;
+import org.springframework.data.domain.ExampleMatcher.PropertySpecifier;
+import org.springframework.data.util.StringMatcher;
+import org.springframework.util.Assert;
+
+/**
+ * Accessor for the {@link ExampleMatcher} to use in modules that support query by example (QBE) querying.
+ *
+ * @author Mark Paluch
+ * @author Oliver Gierke
+ * @author Christoph Strobl
+ * @author Jens Schauder
+ * @since 1.12
+ */
+public class ExampleMatcherAccessor {
+
+ private final ExampleMatcher matcher;
+
+ /**
+ * Creates a new {@link ExampleMatcherAccessor} for the given {@link ExampleMatcher}.
+ *
+ * @param matcher must not be {@literal null}.
+ */
+ public ExampleMatcherAccessor(ExampleMatcher matcher) {
+
+ Assert.notNull(matcher, "ExampleMatcher must not be null!");
+
+ this.matcher = matcher;
+ }
+
+ /**
+ * Returns the {@link PropertySpecifier}s of the underlying {@link ExampleMatcher}.
+ *
+ * @return unmodifiable {@link Collection} of {@link ExampleMatcher.PropertySpecifier}s.
+ */
+ public Collection getPropertySpecifiers() {
+ return matcher.getPropertySpecifiers().getSpecifiers();
+ }
+
+ /**
+ * Returns whether the underlying {@link ExampleMatcher} contains a {@link PropertySpecifier} for the given path.
+ *
+ * @param path the dot-path identifying a property.
+ * @return {@literal true} in case {@link ExampleMatcher.PropertySpecifier} defined for given path.
+ */
+ public boolean hasPropertySpecifier(String path) {
+ return matcher.getPropertySpecifiers().hasSpecifierForPath(path);
+ }
+
+ /**
+ * Get the {@link ExampleMatcher.PropertySpecifier} for given path.
+ * Please check if {@link #hasPropertySpecifier(String)} to avoid running into {@literal null} values.
+ *
+ * @param path Dot-Path to property.
+ * @return {@literal null} when no {@link ExampleMatcher.PropertySpecifier} defined for path.
+ */
+ public ExampleMatcher.PropertySpecifier getPropertySpecifier(String path) {
+ return matcher.getPropertySpecifiers().getForPath(path);
+ }
+
+ /**
+ * @return true if at least one {@link ExampleMatcher.PropertySpecifier} defined.
+ */
+ public boolean hasPropertySpecifiers() {
+ return matcher.getPropertySpecifiers().hasValues();
+ }
+
+ /**
+ * Get the {@link ExampleMatcher.StringMatcher} for a given path or return the default one if none defined.
+ *
+ * @param path
+ * @return never {@literal null}.
+ */
+ public ExampleMatcher.StringMatcher getStringMatcherForPath(String path) {
+
+ if (!hasPropertySpecifier(path)) {
+ return matcher.getDefaultStringMatcher();
+ }
+
+ ExampleMatcher.PropertySpecifier specifier = getPropertySpecifier(path);
+ return specifier.getStringMatcher() != null ? specifier.getStringMatcher() : matcher.getDefaultStringMatcher();
+ }
+
+ /**
+ * Get defined null handling.
+ *
+ * @return never {@literal null}
+ */
+ public ExampleMatcher.NullHandler getNullHandler() {
+ return matcher.getNullHandler();
+ }
+
+ /**
+ * Get defined {@link ExampleMatcher.StringMatcher}.
+ *
+ * @return never {@literal null}.
+ */
+ public ExampleMatcher.StringMatcher getDefaultStringMatcher() {
+ return matcher.getDefaultStringMatcher();
+ }
+
+ /**
+ * @return {@literal true} if {@link String} should be matched with ignore case option.
+ */
+ public boolean isIgnoreCaseEnabled() {
+ return matcher.isIgnoreCaseEnabled();
+ }
+
+ /**
+ * @param path
+ * @return return {@literal true} if path was set to be ignored.
+ */
+ public boolean isIgnoredPath(String path) {
+ return matcher.isIgnoredPath(path);
+ }
+
+ /**
+ * Get the ignore case flag for a given path or return the default one if none defined.
+ *
+ * @param path
+ * @return never {@literal null}.
+ */
+ public boolean isIgnoreCaseForPath(String path) {
+
+ if (!hasPropertySpecifier(path)) {
+ return matcher.isIgnoreCaseEnabled();
+ }
+
+ ExampleMatcher.PropertySpecifier specifier = getPropertySpecifier(path);
+ return specifier.getIgnoreCase() != null ? specifier.getIgnoreCase() : matcher.isIgnoreCaseEnabled();
+ }
+
+ /**
+ * Get the ignore case flag for a given path or return {@link ExampleMatcher.NoOpPropertyValueTransformer} if none
+ * defined.
+ *
+ * @param path
+ * @return never {@literal null}.
+ */
+ public ExampleMatcher.PropertyValueTransformer getValueTransformerForPath(String path) {
+
+ if (!hasPropertySpecifier(path)) {
+ return ExampleMatcher.NoOpPropertyValueTransformer.INSTANCE;
+ }
+
+ return getPropertySpecifier(path).getPropertyValueTransformer();
+ }
+}
diff --git a/src/test/java/org/springframework/data/DependencyTests.java b/src/test/java/org/springframework/data/DependencyTests.java
new file mode 100644
index 000000000..2f7a754cf
--- /dev/null
+++ b/src/test/java/org/springframework/data/DependencyTests.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.data;
+
+import static de.schauderhaft.degraph.check.JCheck.*;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+/**
+ * @author Jens Schauder
+ */
+public class DependencyTests {
+
+ @Test
+ public void noInternalPackageCycles() {
+
+ assertThat(
+ classpath() //
+ .noJars() //
+ .including("org.springframework.data.**") //
+ .filterClasspath("*target/classes") //
+ .printOnFailure("degraph.graphml"), //
+ violationFree() //
+ );
+ }
+
+}
diff --git a/src/test/java/org/springframework/data/repository/core/support/ExampleSpecificationAccessorUnitTests.java b/src/test/java/org/springframework/data/repository/core/support/ExampleSpecificationAccessorUnitTests.java
index f60da4cb8..be6c217a8 100755
--- a/src/test/java/org/springframework/data/repository/core/support/ExampleSpecificationAccessorUnitTests.java
+++ b/src/test/java/org/springframework/data/repository/core/support/ExampleSpecificationAccessorUnitTests.java
@@ -26,6 +26,7 @@ import org.springframework.data.domain.ExampleMatcher.NoOpPropertyValueTransform
import org.springframework.data.domain.ExampleMatcher.NullHandler;
import org.springframework.data.domain.ExampleMatcher.PropertyValueTransformer;
import org.springframework.data.domain.ExampleMatcher.StringMatcher;
+import org.springframework.data.support.ExampleMatcherAccessor;
/**
* Unit tests for {@link ExampleMatcherAccessor}.