Spring Data Commons

org.springframework.data.repository.query.parser
Enum Part.Type

java.lang.Object
  extended by java.lang.Enum<Part.Type>
      extended by org.springframework.data.repository.query.parser.Part.Type
All Implemented Interfaces:
Serializable, Comparable<Part.Type>
Enclosing class:
Part

public static enum Part.Type
extends Enum<Part.Type>

The type of a method name part. Used to create query parts in various ways.

Author:
Oliver Gierke

Enum Constant Summary
AFTER
           
BEFORE
           
BETWEEN
           
CONTAINING
           
ENDING_WITH
           
EXISTS
           
FALSE
           
GREATER_THAN
           
GREATER_THAN_EQUAL
           
IN
           
IS_NOT_NULL
           
IS_NULL
           
LESS_THAN
           
LESS_THAN_EQUAL
           
LIKE
           
NEAR
           
NEGATING_SIMPLE_PROPERTY
           
NOT_IN
           
NOT_LIKE
           
REGEX
           
SIMPLE_PROPERTY
           
STARTING_WITH
           
TRUE
           
WITHIN
           
 
Field Summary
static Collection<String> ALL_KEYWORDS
           
 
Method Summary
 String extractProperty(String part)
          Callback method to extract the actual propertyPath to be bound from the given part.
static Part.Type fromProperty(String rawProperty)
          Returns the Part.Type of the Part for the given raw propertyPath.
 Collection<String> getKeywords()
          Returns all keywords supported by the current Part.Type.
 int getNumberOfArguments()
          Returns the number of arguments the propertyPath binds.
protected  boolean supports(String property)
          Returns whether the the type supports the given raw propertyPath.
static Part.Type valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Part.Type[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

BETWEEN

public static final Part.Type BETWEEN

IS_NOT_NULL

public static final Part.Type IS_NOT_NULL

IS_NULL

public static final Part.Type IS_NULL

LESS_THAN

public static final Part.Type LESS_THAN

LESS_THAN_EQUAL

public static final Part.Type LESS_THAN_EQUAL

GREATER_THAN

public static final Part.Type GREATER_THAN

GREATER_THAN_EQUAL

public static final Part.Type GREATER_THAN_EQUAL

BEFORE

public static final Part.Type BEFORE

AFTER

public static final Part.Type AFTER

NOT_LIKE

public static final Part.Type NOT_LIKE

LIKE

public static final Part.Type LIKE

STARTING_WITH

public static final Part.Type STARTING_WITH

ENDING_WITH

public static final Part.Type ENDING_WITH

CONTAINING

public static final Part.Type CONTAINING

NOT_IN

public static final Part.Type NOT_IN

IN

public static final Part.Type IN

NEAR

public static final Part.Type NEAR

WITHIN

public static final Part.Type WITHIN

REGEX

public static final Part.Type REGEX

EXISTS

public static final Part.Type EXISTS

TRUE

public static final Part.Type TRUE

FALSE

public static final Part.Type FALSE

NEGATING_SIMPLE_PROPERTY

public static final Part.Type NEGATING_SIMPLE_PROPERTY

SIMPLE_PROPERTY

public static final Part.Type SIMPLE_PROPERTY
Field Detail

ALL_KEYWORDS

public static final Collection<String> ALL_KEYWORDS
Method Detail

values

public static Part.Type[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Part.Type c : Part.Type.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Part.Type valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

fromProperty

public static Part.Type fromProperty(String rawProperty)
Returns the Part.Type of the Part for the given raw propertyPath. This will try to detect e.g. keywords contained in the raw propertyPath that trigger special query creation. Returns SIMPLE_PROPERTY by default.

Parameters:
rawProperty -
Returns:

getKeywords

public Collection<String> getKeywords()
Returns all keywords supported by the current Part.Type.

Returns:

supports

protected boolean supports(String property)
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 as is.

Parameters:
propertyPath -
Returns:

getNumberOfArguments

public int getNumberOfArguments()
Returns the number of arguments the propertyPath binds. By default this exactly one argument.

Returns:

extractProperty

public String extractProperty(String part)
Callback method to extract the actual propertyPath to be bound from the given part. Strips the keyword from the part's end if available.

Parameters:
part -
Returns:

Spring Data Commons

Copyright © 2012. All Rights Reserved.