|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.jaw.reference.query.Query
This class supports construction of object query constraints. The static methods provided return query expressions that may be used in listing and enumerating managed objects. Individual methods for constructing constraints only allow appropriate types as arguments. Composition of calls can construct arbitrary nestings of constraints.
An example follows:
QueryExp exp = Query.and(Query.gt(Query.attr("age"), Query.value(5)),
Query.match(Query.attr("name"),
Query.value("G*ling")));
AttributeExp
,
StringValueExp
,
QueryExp
,
ValueExp
Field Summary | |
static int |
DIV
|
static int |
EQ
|
static int |
GE
|
static int |
GT
|
static int |
LE
|
static int |
LT
|
static int |
MINUS
|
static int |
PLUS
|
static int |
TIMES
|
Constructor Summary | |
Query()
|
Method Summary | |
static QueryExp |
and(QueryExp q1,
QueryExp q2)
Returns a query expression that is the conjunction of two other query expressions. |
static QueryExp |
anySubstring(AttributeExp a1,
StringValueExp s)
Returns a query expression that represents a matching constraint on a string argument. |
static AttributeExp |
attr(java.lang.String name)
Returns a new attribute expression which can be used in any Query call that expects an AttributeExp or a
ValueExp . |
static IndexedAttributeExp |
attr(java.lang.String name,
int index)
Returns a new indexed attribute expression which can be used in any Query call that expects an AttributeExp or a
ValueExp . |
static QualifiedAttributeExp |
attr(java.lang.String className,
java.lang.String name)
Returns a new qualified attribute expression which can be used in any Query call that expects an AttributeExp or a
ValueExp . |
static QualifiedIndexedAttributeExp |
attr(java.lang.String className,
java.lang.String name,
int index)
Returns a new qualified attribute expression which can be used in any Query call that expects an AttributeExp or a
ValueExp . |
static QueryExp |
between(ValueExp v1,
ValueExp v2,
ValueExp v3)
Returns a query expression that represents the constraint that one value lies between two other values. |
static BinaryOpExpression |
div(ValueExp value1,
ValueExp value2)
Return a binary expression representing the quotient of two numeric values. |
static QueryExp |
eq(ValueExp v1,
ValueExp v2)
Returns a query expression that represents an equality constraint on two values. |
static QueryExp |
finalSubstring(AttributeExp a1,
StringValueExp s)
Returns a query expression that represents a matching constraint on a string argument. |
static QueryExp |
geq(ValueExp v1,
ValueExp v2)
Returns a query expression that represents a "greater than or equal to" constraint on two values. |
java.lang.String |
getClassVersion()
Returns the version of this class. |
static QueryExp |
gt(ValueExp v1,
ValueExp v2)
Returns a query expression that represents a "greater than" constraint on two values. |
static InQueryExp |
in(ValueExp val,
ValueExp[] valueList)
Returns an expression constraining a value to be one of an explicit list. |
static QueryExp |
initialSubstring(AttributeExp a1,
StringValueExp s)
Returns a query expression that represents a matching constraint on a string argument. |
static QueryExp |
leq(ValueExp v1,
ValueExp v2)
Returns a query expression that represents a "less than or equal to" constraint on two values. |
static QueryExp |
lt(ValueExp v1,
ValueExp v2)
Returns a query expression that represents a "less than" constraint on two values. |
static QueryExp |
match(AttributeExp a1,
StringValueExp s)
Returns a query expression that represents a matching constraint on a string argument. |
static BinaryOpExpression |
minus(ValueExp value1,
ValueExp value2)
Return a binary expression representing the difference of two numeric values. |
static NotQueryExp |
not(QueryExp queryExp)
Returns a constraint that is the negation of its argument. |
static QueryExp |
or(QueryExp q1,
QueryExp q2)
Returns a query expression that is the disjunction of two other query expressions. |
static BinaryOpExpression |
plus(ValueExp value1,
ValueExp value2)
Returns a binary expression representing the sum of two numeric values or the concatenation of two string values. |
static BinaryOpExpression |
times(ValueExp value1,
ValueExp value2)
Return a binary expression representing the product of two value expressions. |
static ValueExp |
value(boolean val)
Returns a boolean value expression that can be used in any Query call that expects a ValueExp . |
static ValueExp |
value(double val)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp . |
static ValueExp |
value(float val)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp . |
static ValueExp |
value(int val)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp . |
static ValueExp |
value(long val)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp . |
static ValueExp |
value(java.lang.Number val)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp . |
static StringValueExp |
value(java.lang.String val)
Returns a new string expression which can be used in any Query call that expects a StringValueExp
or a ValueExp . |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int GT
public static final int LT
public static final int GE
public static final int LE
public static final int EQ
public static final int PLUS
public static final int MINUS
public static final int TIMES
public static final int DIV
Constructor Detail |
public Query()
Method Detail |
public java.lang.String getClassVersion()
public static QueryExp and(QueryExp q1, QueryExp q2)
q1
- A query expression.q2
- Another query expression.public static QueryExp or(QueryExp q1, QueryExp q2)
q1
- A query expression.q2
- Another query expression.public static QueryExp gt(ValueExp v1, ValueExp v2)
v1
- A value expression.v2
- Another value expression.public static QueryExp geq(ValueExp v1, ValueExp v2)
v1
- A value expression.v2
- Another value expression.public static QueryExp leq(ValueExp v1, ValueExp v2)
v1
- A value expression.v2
- Another value expression.public static QueryExp lt(ValueExp v1, ValueExp v2)
v1
- A value expression.v2
- Another value expression.public static QueryExp eq(ValueExp v1, ValueExp v2)
v1
- A value expression.v2
- Another value expression.public static QueryExp between(ValueExp v1, ValueExp v2, ValueExp v3)
v1
- A value expression.v2
- Another value expression.v3
- Another value expression.public static QueryExp match(AttributeExp a1, StringValueExp s)
*
for any character sequence
?
for a single arbitrary character.a*b?c
would match any number of
a
s followed by a b
, any single
character, and a c
.a
- An attribute expression.s
- A string value expression representing a
matching constraint.public static QueryExp initialSubstring(AttributeExp a1, StringValueExp s)
a
- An attribute expression.s
- A string value expression representing the
beginning of the string value.public static QueryExp anySubstring(AttributeExp a1, StringValueExp s)
a
- An attribute expression.s
- A string value expression representing the
"middle" of the string value.public static QueryExp finalSubstring(AttributeExp a1, StringValueExp s)
a
- An attribute expression.s
- A string value expression representing the
end of the string value.public static AttributeExp attr(java.lang.String name)
AttributeExp
or a
ValueExp
.name
- The name of the attribute.public static QualifiedAttributeExp attr(java.lang.String className, java.lang.String name)
AttributeExp
or a
ValueExp
.class
- The class possessing the attribute.name
- The name of the attribute.public static IndexedAttributeExp attr(java.lang.String name, int index)
AttributeExp
or a
ValueExp
.name
- The name of the attribute.public static QualifiedIndexedAttributeExp attr(java.lang.String className, java.lang.String name, int index)
AttributeExp
or a
ValueExp
.class
- The class possessing the attribute.name
- The name of the attribute.public static NotQueryExp not(QueryExp queryExp)
queryExp
- The constraint to be negated.public static InQueryExp in(ValueExp val, ValueExp[] valueList)
val
- A value to be constrained.valueList
- An array of ValueExps.InQueryExp
that represents the
constraint.public static StringValueExp value(java.lang.String val)
Query
call that expects a StringValueExp
or a ValueExp
.val
- The string value.StringValueExp
object containing the
string argument.public static ValueExp value(java.lang.Number val)
Query
call that expects a ValueExp
.val
- An instance of Number.NumericValue
object containing the argument.public static ValueExp value(int val)
Query
call that expects a ValueExp
.val
- An integer value.NumericValue
object containing the argument.public static ValueExp value(long val)
Query
call that expects a ValueExp
.val
- A long value.NumericValue
object containing the argument.public static ValueExp value(float val)
Query
call that expects a ValueExp
.val
- A floating point value.NumericValue
object containing the argument.public static ValueExp value(double val)
Query
call that expects a ValueExp
.val
- A double-precision value.NumericValue
object containing the argument.public static ValueExp value(boolean val)
Query
call that expects a ValueExp
.val
- A boolean value.NumericValue
object containing the argument.public static BinaryOpExpression plus(ValueExp value1, ValueExp value2)
value1
- An argument to '+'.value2
- Another argument to '+'.BinaryOpExpression
representing
the sum or concatenation.public static BinaryOpExpression times(ValueExp value1, ValueExp value2)
value1
- An argument to '*'.value2
- Another argument to '*'.BinaryOpExpression
representing
the product.public static BinaryOpExpression minus(ValueExp value1, ValueExp value2)
value1
- An argument to '-'.value2
- Another argument to '-'.BinaryOpExpression
representing
the difference.public static BinaryOpExpression div(ValueExp value1, ValueExp value2)
value1
- An argument to '/'.value2
- Another argument to '/'.BinaryOpExpression
representing
the quotient.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |