KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jofti > api > IndexQuery


1 /*
2  * Copyright (C) <2005> <Steve Woodcock>
3  * Created on 07-Oct-2004
4  *
5  */

6 package com.jofti.api;
7
8 /**
9
10  *
11  * Root interface for query objects. All IndexQueries will implement this interface, but not all are required
12  * to provide implementations of the optional parameter setting methods.<p>
13  *
14  * @author Steve Woodcock<br>
15  * @version 1.7<p>
16  */

17 public interface IndexQuery {
18
19     /**
20      * <p>
21      * Sets a parameter on a Query by name. The name should match a String representation of the
22      * parameter in the query implementation. The format of the name is defined by the type of query.
23      * </p>
24      * <p>
25      * The method returns the IndexQuery in order to allow method chaining for parameter setting.
26      * </p>
27      * @param name - the name for the parameter.
28      * @param value - the Object that is used to bind to the parameter.
29      * @return - The indexQuery that the parameter was set on.
30      */

31     public IndexQuery setParameter(String JavaDoc name, Object JavaDoc value);
32     
33     /**
34      * <p>
35      * Sets a parameter on a Query by name. The name should match the numeric position of the
36      * parameter in the query implmentation. The format of the name is defined by the type of query.
37      * </p>
38      * <p>
39      * The method returns the IndexQuery in order to allow method chaining for parameter setting.
40      * </p>
41      * @param position - the position for the parameter.
42      * @param value - the Object that is used to bind to the parameter.
43      * @return - The indexQuery that the parameter was set on.
44      */

45     public IndexQuery setParameter(int position, Object JavaDoc value);
46     
47     
48     /**
49      * <p>
50      * Sets a maximum number of results to return in the query. If the results are not ordered then
51      * repeated calling of the method could return different results irrespective of data changes.
52      * </p>
53      * <p>
54      * When ordering is set repeated calls with this value set will return the same results providing
55      * that the data has not changed. However, in order to provide ordering the full result set must
56      * be evaluated and are therefore loaded into memory. The results falling outside the return range will then be discarded.
57      * </p>
58      * <p>
59      * A negative value will return a runtime IllegalArgumentException. Zero is equivalent to all results. Setting the value to more than
60      * the number of results found will results in all results being returned.
61      * The method returns the IndexQuery in order to allow method chaining for parameter setting.
62      * </p>
63      * @param maxResults - the maximum number of results to return.
64      * @return - The indexQuery that the parameter was set on.
65      */

66     public IndexQuery setMaxResults(int maxResults);
67     
68     /**
69      * <p>
70      * Sets the first result number to be returned. If this is used in conjunction with maxResults then a paging type
71      * mechanism can be emulated (providing the results are ordered). A negative value will result in a runtimeException and setting the value
72      * larger than the number of results will result in zero results returned.
73      * </p>
74      * <p>
75      * The method returns the IndexQuery in order to allow method chaining for parameter setting.
76      * </p>
77      * @param firstResult - the position of the first result - this is 0 indexed.
78      * @return - The indexQuery that the parameter was set on.
79      */

80     public IndexQuery setFirstResult(int firstResult);
81     
82 }
83
Popular Tags