DATACMNS-448 - Added infrastructure for 'deleteBy' queries.

Add keywords 'delete' and 'remove' to PartTree indicating presence of delete intend.

Original pull request: #72.
This commit is contained in:
Oliver Gierke
2014-03-06 13:44:38 +01:00
parent 5d0f3b4b6d
commit 4f25a8da24

View File

@@ -39,11 +39,6 @@ import org.springframework.util.StringUtils;
*/
public class PartTree implements Iterable<OrPart> {
private static final String DELETE_PATTERN = "delete|remove";
private static final Pattern PREFIX_TEMPLATE = Pattern.compile("^(find|read|get|count|query|" + DELETE_PATTERN
+ ")(\\p{Lu}.*?)??By");
/*
* We look for a pattern of: keyword followed by
*
@@ -55,6 +50,9 @@ public class PartTree implements Iterable<OrPart> {
* @see http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#ubc
*/
private static final String KEYWORD_TEMPLATE = "(%s)(?=(\\p{Lu}|\\P{InBASIC_LATIN}))";
private static final String DELETE_PATTERN = "delete|remove";
private static final Pattern PREFIX_TEMPLATE = Pattern.compile("^(find|read|get|count|query|" + DELETE_PATTERN
+ ")(\\p{Lu}.*?)??By");
/**
* The subject, for example "findDistinctUserByNameOrderByAge" would have the subject "DistinctUser".