001: /*
002: * Created on Jun 5, 2005
003: *
004: */
005: package com.jofti.query.namespace;
006:
007: /**
008: *
009: *
010: * A utility class to enable simple queries to be done easily. The Query matches everything larger than the
011: * value passed in for that particular field. The optional inclusive flag allows the behaviour to be either >= or just >.
012: * <p>
013: * All nameSpace queries must provide a correct namespace type for the implementation. Some nameSPaces
014: * are hierachical and so the search will use the nameSpace as starting point. Others are flat and so there is no
015: * traversal step.
016: * <p>
017: * This query acannot be combined with any other. iF you want to construct more complex queries use the @link com.jofti.query.Query class.
018: * <p>
019: * @author Steve Woodcock
020: */
021: public class MatchNSLargerQuery extends MatchNSRangeQuery {
022:
023: /**
024: * Construct a query supplying the classname of the object type to be returned, the namespace
025: * under which to start the search. The field to be queried and the value to be used.
026: * <p>
027: * The field type in the object and the value must be of the same type.
028: * <p>
029: * It is assumed that the search is inclusive.
030: * <p>
031: * An example usage (for JBossCache) would be:
032: * <p>
033: * new MatchNSLargerQuery("org.package.Myclass", "/test", "myProperty" ,"some value");
034: * <p>
035: * @param className - the class of object to be returned.
036: * @param nameSpace - the name space to be searched.
037: * @param propertyName - the field name to use
038: * @param value - the value that is used as the search value.
039: */
040: public MatchNSLargerQuery(Class className, Object nameSpace,
041: String propertyName, Comparable value) {
042: this (className, nameSpace, propertyName, value, null);
043: }
044:
045: public MatchNSLargerQuery(Class className, Object nameSpace,
046: String propertyName, Comparable value, Object alias) {
047: super (className, nameSpace, propertyName, value, null, alias);
048: }
049:
050: public MatchNSLargerQuery(String className, Object nameSpace,
051: String propertyName, Comparable value) {
052: this (className, nameSpace, propertyName, value, null);
053: }
054:
055: public MatchNSLargerQuery(String className, Object nameSpace,
056: String propertyName, Comparable value, Object alias) {
057: super (className, nameSpace, propertyName, value, null, alias);
058: }
059:
060: /**
061: * Construct a query supplying the classname of the object type to be returned, the namespace
062: * under which to start the search. The field to be queried and the value to be used. The method
063: * also allows control of whether the query is inclusive of the value or not.
064: * <p>
065: * The field type in the object and the value must be of the same type.
066: * <p>
067: * An example usage (for JBossCache) would be:
068: * <p>
069: * new MatchNSLargerQuery("org.package.Myclass", "/test", "myProperty" ,"some value");
070: * <p>
071: * @param className - the class of object to be returned.
072: * @param nameSpace - the name space to be searched.
073: * @param propertyName - the field name to use
074: * @param value - the value that is used as the search value.
075: * @param inclusive - indicates if the value is to be inclusive in range.
076: */
077: public MatchNSLargerQuery(Class className, Object nameSpace,
078: String propertyName, Comparable value, boolean inclusive) {
079: this (className, nameSpace, propertyName, value, inclusive, null);
080: }
081:
082: public MatchNSLargerQuery(Class className, Object nameSpace,
083: String propertyName, Comparable value, boolean inclusive,
084: Object alias) {
085: super (className, nameSpace, propertyName, value, null,
086: inclusive, alias);
087: }
088:
089: public MatchNSLargerQuery(String className, Object nameSpace,
090: String propertyName, Comparable value, boolean inclusive) {
091: this (className, nameSpace, propertyName, value, inclusive, null);
092: }
093:
094: public MatchNSLargerQuery(String className, Object nameSpace,
095: String propertyName, Comparable value, boolean inclusive,
096: Object alias) {
097: super (className, nameSpace, propertyName, value, null,
098: inclusive, alias);
099: }
100:
101: /**
102: * Construct a query supplying the value to be searched against and the namespace
103: * under which to start the search. This is a convenience method for classes (such as String,Integer etc)
104: * that have no property value as such. Instead the value is the class type.
105: * <p>
106: *
107: * An example usage (for JBossCache) would be:
108: * <p>
109: * new MatchNSLargerQuery( "/test","some value",true);
110: * <p>
111: * This is so you do not have to use the methods above in the manner of
112: * <p>
113: * new MatchNSLargerQuery("java.lang.String", "/test", null ,"some value");
114: * <p>
115:
116: * @param nameSpace - the name space to be searched.
117: * @param value - the value that is used as the search value.
118: * @param inclusive - indicates if the value is to be inclusive in range.
119: */
120: public MatchNSLargerQuery(Object nameSpace, Comparable value,
121: boolean inclusive) {
122: super (nameSpace, value, null, inclusive, null);
123: }
124:
125: public MatchNSLargerQuery(Object nameSpace, Comparable value,
126: boolean inclusive, Object alias) {
127: super(nameSpace, value, null, inclusive, alias);
128: }
129:
130: }
|