001: /*
002: * Copyright (C) <2005> <Steve Woodcock> * * 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 smaller 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: *
020: *@author Steve Woodcock
021: */
022: public class MatchNSSmallerQuery extends MatchNSRangeQuery {
023:
024: /**
025: * Construct a query supplying the classname of the object type to be returned, the namespace
026: * under which to start the search. The field to be queried and the value to be used.
027: * <p>
028: * The field type in the object and the value must be of the same type.
029: * <p>
030: * It is assumed that the search is inclusive.
031: * <p>
032: * An example usage (for JBossCache) would be:
033: * <p>
034: * new MatchNSSmallerQuery("org.package.Myclass", "/test", "myProperty" ,"some value");
035: * <p>
036: * @param className - the class of object to be returned.
037: * @param nameSpace - the name space to be searched.
038: * @param propertyName - the field name to use
039: * @param value - the value that is used as the search value.
040: */
041: public MatchNSSmallerQuery(Class className, Object nameSpace,
042: String propertyName, Comparable value) {
043: super (className, nameSpace, propertyName, null, value);
044: }
045:
046: public MatchNSSmallerQuery(Class className, Object nameSpace,
047: String propertyName, Comparable value, Object alias) {
048: super (className, nameSpace, propertyName, null, value, alias);
049: }
050:
051: public MatchNSSmallerQuery(String className, Object nameSpace,
052: String propertyName, Comparable value) {
053: super (className, nameSpace, propertyName, null, value, null);
054: }
055:
056: public MatchNSSmallerQuery(String className, Object nameSpace,
057: String propertyName, Comparable value, Object alias) {
058: super (className, nameSpace, propertyName, null, value, alias);
059: }
060:
061: /**
062: * Construct a query supplying the classname of the object type to be returned, the namespace
063: * under which to start the search. The field to be queried and the value to be used. The method
064: * also allows control of whether the query is inclusive of the value or not.
065: * <p>
066: * The field type in the object and the value must be of the same type.
067: * <p>
068: * An example usage (for JBossCache) would be:
069: * <p>
070: * new MatchNSSmallerQuery("org.package.Myclass", "/test", "myProperty" ,"some value");
071: * <p>
072: * @param className - the class of object to be returned.
073: * @param nameSpace - the name space to be searched.
074: * @param propertyName - the field name to use
075: * @param value - the value that is used as the search value.
076: * @param inclusive - indicates if the value is to be inclusive in range.
077: */
078: public MatchNSSmallerQuery(Class className, Object nameSpace,
079: String propertyName, Comparable value, boolean inclusive) {
080: super (className, nameSpace, propertyName, null, value,
081: inclusive, null);
082: }
083:
084: public MatchNSSmallerQuery(Class className, Object nameSpace,
085: String propertyName, Comparable value, boolean inclusive,
086: Object alias) {
087: super (className, nameSpace, propertyName, null, value,
088: inclusive, alias);
089: }
090:
091: /**
092: * Construct a query supplying the value to be searched against and the namespace
093: * under which to start the search. This is a convenience method for classes (such as String,Integer etc)
094: * that have no property value as such. Instead the value is the class type.
095: *
096: * <p>
097: * An example usage (for JBossCache) would be:
098: * <p>
099: * new MatchNSSmallerQuery( "/test","some value",true);
100: * <p>
101: * This is so you do not have to use the methods above in the manner of
102: * <p>
103: * new MatchNSSmallerQuery("java.lang.String", "/test", null ,"some value");
104: * <p>
105:
106: * @param nameSpace - the name space to be searched.
107: * @param value - the value that is used as the search value.
108: * @param inclusive - indicates if the value is to be inclusive in range.
109: */
110: public MatchNSSmallerQuery(Object nameSpace, Comparable value,
111: boolean inclusive) {
112: super (nameSpace, null, value, inclusive, null);
113: }
114:
115: public MatchNSSmallerQuery(Object nameSpace, Comparable value,
116: boolean inclusive, Object alias) {
117: super(nameSpace, null, value, inclusive, alias);
118: }
119: }
|