org.rhq.enterprise.server.resource.group.definition.framework
Class ExpressionEvaluator

java.lang.Object
  extended by org.rhq.enterprise.server.resource.group.definition.framework.ExpressionEvaluator
All Implemented Interfaces:
java.lang.Iterable<ExpressionEvaluator.Result>

public class ExpressionEvaluator
extends java.lang.Object
implements java.lang.Iterable<ExpressionEvaluator.Result>


Nested Class Summary
 class ExpressionEvaluator.Result
           
 
Constructor Summary
ExpressionEvaluator()
           
 
Method Summary
 ExpressionEvaluator addExpression(java.lang.String expression)
           
 void execute()
           
 java.lang.String getComputedJPQLGroupStatement()
           
 java.lang.String getComputedJPQLStatement()
           
 java.util.Iterator<ExpressionEvaluator.Result> iterator()
           
 void setTestMode(boolean mode)
           
 java.util.List<java.lang.String> tokenizeCondition(java.lang.String condition)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionEvaluator

public ExpressionEvaluator()
Method Detail

setTestMode

public void setTestMode(boolean mode)
Parameters:
mode - passing a value of true will bypass query later and only compute the effective JPQL statements, handy for testing

addExpression

public ExpressionEvaluator addExpression(java.lang.String expression)
                                  throws InvalidExpressionException
Parameters:
expression - a string in the form of 'condition = value' or 'groupBy condition'
Returns:
a reference to itself, so that method chaining can be used
Throws:
InvalidExpressionException - if the expression can not be parsed for any reason, the message will try to get the details as to the parse failure

getComputedJPQLStatement

public java.lang.String getComputedJPQLStatement()
Returns:
the JPQL statement that will be sent to the database, assuming test mode is false (the default): -- if no groupBy expressions are present, it will query for the target object -- if at least one groupBy expression was used, it will return the query to find the pivot data

getComputedJPQLGroupStatement

public java.lang.String getComputedJPQLGroupStatement()
Returns:
the JPQL statement that will be sent to the database, assuming test mode is false (the default): -- if no groupBy expressions are present, this will return "" -- if at least one groupBy expression was used, it will return the pivoted query

execute

public void execute()

iterator

public java.util.Iterator<ExpressionEvaluator.Result> iterator()
Specified by:
iterator in interface java.lang.Iterable<ExpressionEvaluator.Result>

tokenizeCondition

public java.util.List<java.lang.String> tokenizeCondition(java.lang.String condition)


Copyright © 2008-2009 Red Hat, Inc.. All Rights Reserved.