Browse Source

DATACMNS-174 - Part.Type now exposes keywords.

1.3.x
Oliver Gierke 14 years ago
parent
commit
6c32b479d3
  1. 22
      spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Part.java

22
spring-data-commons-core/src/main/java/org/springframework/data/repository/query/parser/Part.java

@ -15,7 +15,10 @@ @@ -15,7 +15,10 @@
*/
package org.springframework.data.repository.query.parser;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -188,6 +191,16 @@ public class Part { @@ -188,6 +191,16 @@ public class Part {
GREATER_THAN, GREATER_THAN_EQUAL, BEFORE, AFTER, NOT_LIKE, LIKE, STARTING_WITH, ENDING_WITH, CONTAINING,
NOT_IN, IN, NEAR, WITHIN, REGEX, EXISTS, TRUE, FALSE, NEGATING_SIMPLE_PROPERTY, SIMPLE_PROPERTY);
public static final Collection<String> ALL_KEYWORDS;
static {
List<String> allKeywords = new ArrayList<String>();
for (Type type : ALL) {
allKeywords.addAll(type.keywords);
}
ALL_KEYWORDS = Collections.unmodifiableList(allKeywords);
}
private final List<String> keywords;
private final int numberOfArguments;
@ -228,6 +241,15 @@ public class Part { @@ -228,6 +241,15 @@ public class Part {
return SIMPLE_PROPERTY;
}
/**
* Returns all keywords supported by the current {@link Type}.
*
* @return
*/
public Collection<String> getKeywords() {
return Collections.unmodifiableList(keywords);
}
/**
* Returns whether the the type supports the given raw propertyPath. Default implementation checks whether the
* propertyPath ends with the registered keyword. Does not support the keyword if the propertyPath is a valid field

Loading…
Cancel
Save