Added getBindableValue(int index) to ParameterAccessor.

Adapted ParametersParameterAccessor accordingly.
This commit is contained in:
Oliver Gierke
2011-03-01 20:37:18 +01:00
parent c738effd39
commit b0a04b16c6
2 changed files with 21 additions and 1 deletions

View File

@@ -49,6 +49,19 @@ public interface ParameterAccessor extends Iterable<Object> {
Sort getSort();
/**
* Returns the bindable value with the given index. Bindable means, that
* {@link Pageable} and {@link Sort} values are skipped without noticed in
* the index. For a method signature taking {@link String}, {@link Pageable}
* , {@link String}, {@code #getBindableParameter(1)} would return the
* second {@link String} value.
*
* @param index
* @return
*/
Object getBindableValue(int index);
/**
* Returns an iterator over all <em>bindable</em> parameters. This means
* parameters implementing {@link Pageable} or {@link Sort} will not be

View File

@@ -89,7 +89,14 @@ public class ParametersParameterAccessor implements ParameterAccessor {
}
private Object getBindableValue(int index) {
/*
* (non-Javadoc)
*
* @see
* org.springframework.data.repository.query.ParameterAccessor#getBindableValue
* (int)
*/
public Object getBindableValue(int index) {
return values[parameters.getBindableParameter(index).getIndex()];
}