Spring Data Commons

org.springframework.data.repository.query
Class Parameters

java.lang.Object
  extended by org.springframework.data.repository.query.Parameters
All Implemented Interfaces:
Iterable<Parameter>

public final class Parameters
extends Object
implements Iterable<Parameter>

Abstracts method parameters that have to be bound to query parameters or applied to the query independently.

Author:
Oliver Gierke

Field Summary
static List<Class<?>> TYPES
           
 
Constructor Summary
Parameters(Method method)
          Creates a new instance of Parameters.
 
Method Summary
 Parameter getBindableParameter(int bindableIndex)
          Returns a bindable parameter with the given index.
 Parameters getBindableParameters()
          Returns a Parameters instance with effectively all special parameters removed.
 int getNumberOfParameters()
          Returns the number of parameters.
 int getPageableIndex()
          Returns the index of the Pageable Method parameter if available.
 Parameter getParameter(int index)
          Returns the parameter with the given index.
 int getSortIndex()
          Returns the index of the Sort Method parameter if available.
 boolean hasPageableParameter()
          Returns whether the method the Parameters was created for contains a Pageable argument.
 boolean hasParameterAt(int position)
          Returns whether we have a parameter at the given position.
 boolean hasSortParameter()
          Returns whether the method the Parameters was created for contains a Sort argument.
 boolean hasSpecialParameter()
          Returns whether the method signature contains one of the special parameters (Pageable, Sort).
static boolean isBindable(Class<?> type)
          Returns whether the given type is a bindable parameter.
 Iterator<Parameter> iterator()
           
 boolean potentiallySortsDynamically()
          Returns whether we potentially find a Sort parameter in the parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPES

public static final List<Class<?>> TYPES
Constructor Detail

Parameters

public Parameters(Method method)
Creates a new instance of Parameters.

Parameters:
method -
Method Detail

hasPageableParameter

public boolean hasPageableParameter()
Returns whether the method the Parameters was created for contains a Pageable argument.

Returns:

getPageableIndex

public int getPageableIndex()
Returns the index of the Pageable Method parameter if available. Will return -1 if there is no Pageable argument in the Method's parameter list.

Returns:
the pageableIndex

getSortIndex

public int getSortIndex()
Returns the index of the Sort Method parameter if available. Will return -1 if there is no Sort argument in the Method's parameter list.

Returns:

hasSortParameter

public boolean hasSortParameter()
Returns whether the method the Parameters was created for contains a Sort argument.

Returns:

potentiallySortsDynamically

public boolean potentiallySortsDynamically()
Returns whether we potentially find a Sort parameter in the parameters.

Returns:

getParameter

public Parameter getParameter(int index)
Returns the parameter with the given index.

Parameters:
index -
Returns:

hasParameterAt

public boolean hasParameterAt(int position)
Returns whether we have a parameter at the given position.

Parameters:
position -
Returns:

hasSpecialParameter

public boolean hasSpecialParameter()
Returns whether the method signature contains one of the special parameters (Pageable, Sort).

Returns:

getNumberOfParameters

public int getNumberOfParameters()
Returns the number of parameters.

Returns:

getBindableParameters

public Parameters getBindableParameters()
Returns a Parameters instance with effectively all special parameters removed.

Returns:
See Also:
Parameter.TYPES, Parameter.isSpecialParameter()

getBindableParameter

public Parameter getBindableParameter(int bindableIndex)
Returns a bindable parameter with the given index. So for a method with a signature of (Pageable pageable, String name) a call to #getBindableParameter(0) will return the String parameter.

Parameters:
bindableIndex -
Returns:

isBindable

public static boolean isBindable(Class<?> type)
Returns whether the given type is a bindable parameter.

Parameters:
type -
Returns:

iterator

public Iterator<Parameter> iterator()
Specified by:
iterator in interface Iterable<Parameter>

Spring Data Commons

Copyright © 2011. All Rights Reserved.