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
BETWEEN
           
GREATER_THAN
           
IN
           
IS_NOT_NULL
           
IS_NULL
           
LESS_THAN
           
LIKE
           
NEAR
           
NEGATING_SIMPLE_PROPERTY
           
NOT_IN
           
NOT_LIKE
           
SIMPLE_PROPERTY
           
WITHIN
           
 
Method Summary
 String extractProperty(String part)
          Callback method to extract the actual property to be bound from the given part.
static Part.Type fromProperty(String rawProperty, Class<?> clazz)
          Returns the Part.Type of the Part for the given raw property and the given Class.
 int getNumberOfArguments()
          Returns the number of arguments the property binds.
protected  boolean supports(String property, Class<?> clazz)
          Returns whether the the type supports the given raw property.
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

GREATER_THAN

public static final Part.Type GREATER_THAN

NOT_LIKE

public static final Part.Type NOT_LIKE

LIKE

public static final Part.Type LIKE

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

NEGATING_SIMPLE_PROPERTY

public static final Part.Type NEGATING_SIMPLE_PROPERTY

SIMPLE_PROPERTY

public static final Part.Type SIMPLE_PROPERTY
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,
                                     Class<?> clazz)
Returns the Part.Type of the Part for the given raw property and the given Class. This will try to detect e.g. keywords contained in the raw property that trigger special query creation. Returns SIMPLE_PROPERTY by default.

Parameters:
rawProperty -
clazz -
Returns:

supports

protected boolean supports(String property,
                           Class<?> clazz)
Returns whether the the type supports the given raw property. Default implementation checks whether the property ends with the registered keyword. Does not support the keyword if the property is a valid field as is.

Parameters:
property -
clazz -
Returns:

getNumberOfArguments

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

Returns:

extractProperty

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

Parameters:
part -
Returns:

Spring Data Commons

Copyright © 2011. All Rights Reserved.