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