org.apache.jackrabbit.oak.jcr.query.qom
Enum Operator

java.lang.Object
  extended by java.lang.Enum<Operator>
      extended by org.apache.jackrabbit.oak.jcr.query.qom.Operator
All Implemented Interfaces:
Serializable, Comparable<Operator>

public enum Operator
extends Enum<Operator>

Enumeration of the JCR 2.0 query operators.

Since:
Apache Jackrabbit 2.0

Enum Constant Summary
EQ
           
GE
           
GT
           
LE
           
LIKE
           
LT
           
NE
           
 
Method Summary
 javax.jcr.query.qom.Comparison comparison(javax.jcr.query.qom.QueryObjectModelFactory factory, javax.jcr.query.qom.DynamicOperand left, javax.jcr.query.qom.StaticOperand right)
          Returns a comparison between the given operands using this operator.
 String formatSql(String a, String b)
          Formats an SQL constraint with this operator and the given operands.
 String formatXpath(String a, String b)
          Formats an XPath constraint with this operator and the given operands.
static String[] getAllQueryOperators()
          Returns an array of the names of all the JCR 2.0 query operators.
static Operator getOperatorByName(String name)
          Returns the operator with the given JCR name.
 String toString()
          Returns the JCR 2.0 name of this query operator.
static Operator valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Operator[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

EQ

public static final Operator EQ

NE

public static final Operator NE

GT

public static final Operator GT

GE

public static final Operator GE

LT

public static final Operator LT

LE

public static final Operator LE

LIKE

public static final Operator LIKE
Method Detail

values

public static Operator[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Operator c : Operator.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Operator valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

comparison

public javax.jcr.query.qom.Comparison comparison(javax.jcr.query.qom.QueryObjectModelFactory factory,
                                                 javax.jcr.query.qom.DynamicOperand left,
                                                 javax.jcr.query.qom.StaticOperand right)
                                          throws javax.jcr.RepositoryException
Returns a comparison between the given operands using this operator.

Parameters:
factory - factory for creating the comparison
left - operand on the left hand side
right - operand on the right hand side
Returns:
comparison
Throws:
javax.jcr.RepositoryException - if the comparison can not be created

formatXpath

public String formatXpath(String a,
                          String b)
Formats an XPath constraint with this operator and the given operands. The operands are simply used as-is, without any quoting or escaping.

Parameters:
a - first operand
b - second operand
Returns:
XPath constraint, a op b or jcr:like(a, b) for LIKE

formatSql

public String formatSql(String a,
                        String b)
Formats an SQL constraint with this operator and the given operands. The operands are simply used as-is, without any quoting or escaping.

Parameters:
a - first operand
b - second operand
Returns:
SQL constraint, a op b

toString

public String toString()
Returns the JCR 2.0 name of this query operator.

Overrides:
toString in class Enum<Operator>
Returns:
JCR name of this operator
See Also:
QueryObjectModelConstants

getAllQueryOperators

public static String[] getAllQueryOperators()
Returns an array of the names of all the JCR 2.0 query operators.

Returns:
names of all query operators

getOperatorByName

public static Operator getOperatorByName(String name)
Returns the operator with the given JCR name.

Parameters:
name - JCR name of an operator
Returns:
operator with the given name


Copyright © 2012-2014 The Apache Software Foundation. All Rights Reserved.