KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > engine > FilterDefinition


1 // $Id: FilterDefinition.java,v 1.3 2005/04/26 03:21:57 oneovthafew Exp $
2
package org.hibernate.engine;
3
4 import org.hibernate.type.Type;
5
6 import java.util.Map JavaDoc;
7 import java.util.HashMap JavaDoc;
8 import java.util.Set JavaDoc;
9
10 /**
11  * A FilterDefinition defines the global attributes of a dynamic filter. This
12  * information includes its name as well as its defined parameters (name and type).
13  *
14  * @author Steve Ebersole
15  */

16 public class FilterDefinition {
17     private String JavaDoc filterName;
18     private String JavaDoc defaultFilterCondition;
19     private Map JavaDoc parameterTypes = new HashMap JavaDoc();
20
21     /**
22      * Construct a new FilterDefinition instance.
23      *
24      * @param name The name of the filter for which this configuration is in effect.
25      */

26     public FilterDefinition(String JavaDoc name) {
27         this.filterName = name;
28     }
29
30     /**
31      * Get the name of the filter this configuration defines.
32      *
33      * @return The filter name for this configuration.
34      */

35     public String JavaDoc getFilterName() {
36         return filterName;
37     }
38
39     /**
40      * Get a set of the parameters defined by this configuration.
41      *
42      * @return The parameters named by this configuration.
43      */

44     public Set JavaDoc getParameterNames() {
45         return parameterTypes.keySet();
46     }
47
48     /**
49      * Retreive the type of the named parameter defined for this filter.
50      *
51      * @param parameterName The name of the filter parameter for which to return the type.
52      * @return The type of the named parameter.
53      */

54     public Type getParameterType(String JavaDoc parameterName) {
55         return (Type) parameterTypes.get(parameterName);
56     }
57
58     /**
59      * Add a named parameter to the filter definition.
60      *
61      * @param name The name of the parameter.
62      * @param type The parameter's type.
63      * @return The filter definition instance (for method chaining).
64      */

65     public FilterDefinition addParameterType(String JavaDoc name, Type type) {
66         parameterTypes.put(name, type);
67         return this;
68     }
69
70     public String JavaDoc getDefaultFilterCondition() {
71         return defaultFilterCondition;
72     }
73     
74
75     public void setDefaultFilterCondition(String JavaDoc defaultFilter) {
76         this.defaultFilterCondition = defaultFilter;
77     }
78     
79     public Map JavaDoc getParameterTypes() {
80         return parameterTypes;
81     }
82     
83 }
84
Popular Tags