Developing Apama Applications > Developing Apama Applications in Java > Overview of Apama Java Applications > Optimizing event types > Wildcarding parameters in event types
Wildcarding parameters in event types
Alternatively, if large event types are unavoidable, you can optimize performance by reviewing the usage of these event types in Java, specifically within event templates in event expressions.
If a parameter of an event is never matched against directly within any event expressions, that is only ‘*’ (or wildcard) ever appears against it in event templates, then the event type’s definition can be amended to indicate this. This tells the correlator to ignore this parameter in its internal indexing.
Consider the event type definition presented in About event types
/*
 * Tick.java
 *
 * Class to abstract an Apama stock tick event. A stock tick event
 * describes the trading of a stock, as described by the symbol
 * of the stock being traded, and the price at which the stock was
 * traded
 *
 */
import com.apama.jmon.Event;
 
public class Tick extends Event {
   /** The stock tick symbol */
   public String name;
 
   /** The traded price of the stock tick */
   public double price;
 
   /**
   * No argument constructor
   */
   public Tick() {
     this("", 0);
   }
 
   /**
   * Construct a tick object and set the name and price
   * instance variables
   *
   * @param name The stock symbol of the traded stock
   * @param price The price at which the stock was traded
   */
   public Tick(String name, double price){
     this.name = name;
     this.price = price;
   }
}
If all references to this event type in event expressions look similar to this,

Tick("ACME", *)
that is, where the second parameter price is always specified as a *, then this parameter could be wildcarded in the event type definition.
This can be done by annotating the field in the event type class, as shown here
/** The traded price of the stock tick */
@com.apama.jmon.annotation.Wildcard
public double price;
This definition in the Tick class will override the default behavior, and it lets the correlator know that it can optimize its indexing by ignoring the price parameter.
As many parameters as desired can be wildcarded in this way. For example, if both price and name were to be wildcarded in Tick, they should be defined as follows,
/** The stock tick symbol */
@com.apama.jmon.annotation.Wildcard
public String name;
 
/**The traded price of the stock tick */
@com.apama.jmon.annotation.Wildcard
public double price;
Of course, if you were to do this, then

Tick(*, *)
would be the only valid event template that can be expressed in Java. Any other expression would cause a Java runtime error.
Copyright © 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.