com.atlassian.query.clause
Class TerminalClauseImpl

java.lang.Object
  extended by com.atlassian.query.clause.TerminalClauseImpl
All Implemented Interfaces:
Clause, TerminalClause

public class TerminalClauseImpl
extends Object
implements TerminalClause

Used to represent a terminal node in the query tree.

Since:
v4.0

Constructor Summary
TerminalClauseImpl(String name, Long... values)
          A convienience constructor that will create a clause with the Operator.EQUALS operator if there is only one value in the array and with the Operator.IN operator if there are more than one value in the array.
TerminalClauseImpl(String name, Operator operator, long operand)
          Creates a terminal clause with the specified name, operator and turns the long value into a SingleValueOperand populated with a long value.
TerminalClauseImpl(String name, Operator operator, Operand operand)
          Creates a terminal clause with the specified name, operator and operand.
TerminalClauseImpl(String name, Operator operator, Operand operand, com.atlassian.fugue.Option<Property> property)
          Creates a terminal clause with the specified name, operator, operand and property.
TerminalClauseImpl(String name, Operator operator, String operand)
          Creates a terminal clause with the specified name, operator and turns the string value into a SingleValueOperand populated with a string value.
TerminalClauseImpl(String name, String... values)
          A convienience constructor that will create a clause with the Operator.EQUALS operator if there is only one value in the array and with the Operator.IN operator if there are more than one value in the array.
 
Method Summary
<R> R
accept(ClauseVisitor<R> visitor)
          Allows us to perform operations over the clauses based on the passed in visitor.
 boolean equals(Object o)
           
 List<Clause> getClauses()
           
 String getName()
          The name of the individual clause, this should be unique amongst the implementations otherwise the clauses will be treated as the "same" type of clause.
 Operand getOperand()
           
 Operator getOperator()
           
 com.atlassian.fugue.Option<Property> getProperty()
           
 int hashCode()
           
 String toString()
          Return a string representation of the clause.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TerminalClauseImpl

public TerminalClauseImpl(String name,
                          Operator operator,
                          String operand)
Creates a terminal clause with the specified name, operator and turns the string value into a SingleValueOperand populated with a string value.

Parameters:
name - the name for the clause.
operator - the operator for the clause.
operand - the string value that will be wrapped in a SingleValueOperand.

TerminalClauseImpl

public TerminalClauseImpl(String name,
                          Operator operator,
                          long operand)
Creates a terminal clause with the specified name, operator and turns the long value into a SingleValueOperand populated with a long value.

Parameters:
name - the name for the clause.
operator - the operator for the clause.
operand - the long value that will be wrapped in a SingleValueOperand.

TerminalClauseImpl

public TerminalClauseImpl(String name,
                          Operator operator,
                          Operand operand)
Creates a terminal clause with the specified name, operator and operand.

Parameters:
name - the name for the clause.
operator - the operator for the clause.
operand - the right-hand-side value of the clause.

TerminalClauseImpl

public TerminalClauseImpl(String name,
                          Operator operator,
                          Operand operand,
                          com.atlassian.fugue.Option<Property> property)
Creates a terminal clause with the specified name, operator, operand and property.

Parameters:
name - the name for the clause.
operator - the operator for the clause.
operand - the right-hand-side value of the clause.
property - the name of the property.

TerminalClauseImpl

public TerminalClauseImpl(String name,
                          String... values)
A convienience constructor that will create a clause with the Operator.EQUALS operator if there is only one value in the array and with the Operator.IN operator if there are more than one value in the array.

Parameters:
name - the name for the clause.
values - the string values that will be turned into SingleValueOperand's containing a string value.

TerminalClauseImpl

public TerminalClauseImpl(String name,
                          Long... values)
A convienience constructor that will create a clause with the Operator.EQUALS operator if there is only one value in the array and with the Operator.IN operator if there are more than one value in the array.

Parameters:
name - the name for the clause.
values - the long values that will be turned into SingleValueOperand's containing a long value.
Method Detail

getOperand

public Operand getOperand()
Specified by:
getOperand in interface TerminalClause
Returns:
the right hand side value of the expression. This can be a composite of more Operands or it can be SingleValueOperands that resolve to constant values.

getOperator

public Operator getOperator()
Specified by:
getOperator in interface TerminalClause
Returns:
the operator used by the clause Operator.

getProperty

public com.atlassian.fugue.Option<Property> getProperty()
Specified by:
getProperty in interface TerminalClause
Returns:
the name of the property or absent.

getName

public String getName()
Description copied from interface: Clause
The name of the individual clause, this should be unique amongst the implementations otherwise the clauses will be treated as the "same" type of clause.

Specified by:
getName in interface Clause
Returns:
the name of the individual clause.

getClauses

public List<Clause> getClauses()
Specified by:
getClauses in interface Clause
Returns:
child clauses if the clause has any, empty list if it has none.

accept

public <R> R accept(ClauseVisitor<R> visitor)
Description copied from interface: Clause
Allows us to perform operations over the clauses based on the passed in visitor. This method calls the visit method on the visitor with this reference.

Specified by:
accept in interface Clause
Parameters:
visitor - the visitor to accept.
Returns:
the result of the visit operation who's type is specified by the incoming visitor.

toString

public String toString()
Description copied from interface: Clause
Return a string representation of the clause. This string representation should not be used to represent the clause to the user as it may not be valid. For example, this method makes no attempt to escape invalid names and strings.

Specified by:
toString in interface Clause
Overrides:
toString in class Object
Returns:
the string representation of the clause.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2002-2014 Atlassian. All Rights Reserved.