com.apama.jmon
Class PreparedEventExpression

java.lang.Object
  extended by com.apama.jmon.EventExpression
      extended by com.apama.jmon.PreparedEventExpression
All Implemented Interfaces:
java.io.Serializable

public class PreparedEventExpression
extends EventExpression
implements java.io.Serializable

Instances of this class are created from PreparedEventExpressionTemplate objects. The parameter fields of the PreparedEventExpression can then be filled in to create a fully-qualified event expression, to which MatchListener objects can be attached.

For example, the statement:

PreparedEventExpressionsTemplate et = new PreparedEventExpressionTemplate("on NewsItem(?, *):news -> StockTick(?, *)");
 
creates a template with two paramters, indicated by the '?' characters in the template string. The template may then be instantiated:
PreparedEventExpression pex = et.getInstance();
 pex.setString(0, "ACME");
 pex.setString(1, "ACME");
 
The PreparedEventExpression object may then have MatchListener objects attached to it as usual. In this example the matching NewsItem event is co-assigned to the variable called news. This means that the NewsItem event that caused the match will be available to the MatchListener from the fired MatchEvent by calling evt.getMatchingEvent("news");

When the expression is matched, all registered listeners will be informed. An object implementing the MatchListener interface may be registered by calling the addMatchListener method, and deregistered by calling the removeMatchListener method.

See Also:
Serialized Form

Method Summary
 void addMatchListener(MatchListener listenerToAdd)
          Add a listener to be notified when the match occurs for this event expression.
 void removeAllMatchListeners()
          Remove all previously registered match listeners.
 void setBoolean(int position, boolean value)
          Set a Boolean type parameter in the PreparedEventExpression.
 void setDouble(int position, double value)
          Set a double type parameter in the PreparedEventExpression.
 void setLocation(int position, Location value)
          Set a Location type parameter in the PreparedEventExpression.
 void setLong(int position, long value)
          Set a long type parameter in the PreparedEventExpression.
 void setString(int position, java.lang.String value)
          Set a string type parameter in the PreparedEventExpression.
 java.lang.String toString()
          Get the String value of the PreparedEventExpression,
 
Methods inherited from class com.apama.jmon.EventExpression
getEventExpressionString, removeMatchListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public java.lang.String toString()
Get the String value of the PreparedEventExpression,

Overrides:
toString in class EventExpression
Returns:
A nice String.
See Also:
EventExpression.getEventExpressionString()

setDouble

public void setDouble(int position,
                      double value)
               throws PreparedEventExpressionException
Set a double type parameter in the PreparedEventExpression.

Parameters:
position - Parameter position with the expression template, counting from zero.
value - The double value of the parameter.
Throws:
PreparedEventExpressionException

setLong

public void setLong(int position,
                    long value)
             throws PreparedEventExpressionException
Set a long type parameter in the PreparedEventExpression.

Parameters:
position - Parameter position with the expression template, counting from zero.
value - The long value of the parameter.
Throws:
PreparedEventExpressionException

setString

public void setString(int position,
                      java.lang.String value)
               throws PreparedEventExpressionException
Set a string type parameter in the PreparedEventExpression.

Parameters:
position - Parameter position with the expression template, counting from zero.
value - The string value of the parameter.
Throws:
PreparedEventExpressionException

setBoolean

public void setBoolean(int position,
                       boolean value)
                throws PreparedEventExpressionException
Set a Boolean type parameter in the PreparedEventExpression.

Parameters:
position - Parameter position with the expression template, counting from zero.
value - The Boolean value of the parameter.
Throws:
PreparedEventExpressionException

setLocation

public void setLocation(int position,
                        Location value)
                 throws PreparedEventExpressionException
Set a Location type parameter in the PreparedEventExpression.

Parameters:
position - Parameter position with the expression template, counting from zero.
value - The Location value of the parameter.
Throws:
PreparedEventExpressionException

addMatchListener

public void addMatchListener(MatchListener listenerToAdd)
Add a listener to be notified when the match occurs for this event expression.

Overrides:
addMatchListener in class EventExpression
Parameters:
listenerToAdd - an object implementing the MatchListener interface to be notified when matches occur for this expression.

removeAllMatchListeners

public void removeAllMatchListeners()
Remove all previously registered match listeners.

Overrides:
removeAllMatchListeners in class EventExpression


Submit a bug or feature
Copyright (c) 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors. Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG