本文整理汇总了Java中com.espertech.esper.client.EventBean.getEventType方法的典型用法代码示例。如果您正苦于以下问题:Java EventBean.getEventType方法的具体用法?Java EventBean.getEventType怎么用?Java EventBean.getEventType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.espertech.esper.client.EventBean
的用法示例。
在下文中一共展示了EventBean.getEventType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
// if(oldEvents.length > 0)
if(oldEvents != null)
return;
logger.info("Event occured: " + newEvents.length);
for(int i = 0; i < newEvents.length; i++) {
EventBean event = newEvents[i];
EventType type = event.getEventType();
String[] pro = type.getPropertyNames();
for(int t = 0; t<pro.length; t++) {
logger.info("." + pro[t] + ".");
Object o = event.get(pro[t]);
if(o == null)
logger.info("is null");
else
logger.info(o.toString());
}
// logger.info("object=" + event.get("object"));
// logger.info("subject=" + event.get("subject"));
// logger.info("timestamp=" + event.get("timestamp"));
}
}
示例2: runAssertionMap
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
private void runAssertionMap(EPServiceProvider epService) {
epService.getEPAdministrator().createEPL("create schema MapEventInner(p0 string)");
epService.getEPAdministrator().createEPL("create schema MapEvent(intarray int[], mapinner MapEventInner[])");
EPStatement stmt = epService.getEPAdministrator().createEPL("select * from MapEvent");
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
Map[] mapinner = new Map[] {Collections.singletonMap("p0", "A"), Collections.singletonMap("p0", "B")};
Map map = new HashMap();
map.put("intarray", new int[] {1, 2});
map.put("mapinner", mapinner);
epService.getEPRuntime().sendEvent(map, "MapEvent");
EventBean event = listener.assertOneGetNewAndReset();
EventType type = event.getEventType();
assertEquals(2, type.getGetterIndexed("intarray").get(event, 1));
assertNull(type.getGetterIndexed("dummy"));
assertEquals(mapinner[1], type.getGetterIndexed("mapinner").get(event, 1));
stmt.destroy();
}
示例3: runAssertionOA
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
private void runAssertionOA(EPServiceProvider epService) {
epService.getEPAdministrator().createEPL("create objectarray schema OAEventInner(p0 string)");
epService.getEPAdministrator().createEPL("create objectarray schema OAEvent(intarray int[], oainner OAEventInner[])");
EPStatement stmt = epService.getEPAdministrator().createEPL("select * from OAEvent");
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
Object[] oainner = new Object[] {new Object[] {"A"}, new Object[] {"B"}};
epService.getEPRuntime().sendEvent(new Object[] {new int[] {1, 2}, oainner}, "OAEvent");
EventBean event = listener.assertOneGetNewAndReset();
EventType type = event.getEventType();
assertEquals(2, type.getGetterIndexed("intarray").get(event, 1));
assertNull(type.getGetterIndexed("dummy"));
assertEquals(oainner[1], type.getGetterIndexed("oainner").get(event, 1));
stmt.destroy();
}
示例4: matchEvent
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
public void matchEvent(EventBean theEvent, Collection<FilterHandle> matches) {
EventType eventType = theEvent.getEventType();
// Attempt to match exact type
matchType(eventType, theEvent, matches);
// No supertype means we are done
if (eventType.getSuperTypes() == null) {
return;
}
for (Iterator<EventType> it = eventType.getDeepSuperTypes(); it.hasNext(); ) {
EventType superType = it.next();
matchType(superType, theEvent, matches);
}
}
示例5: update
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
for(EventBean event : newEvents) {
EventType type = event.getEventType();
String[] pro = type.getPropertyNames();
if(pro.length >= 1) {
Object o = event.get(pro[0]);
if(o == null)
violated(null);
else
violated(o.toString());
}
}
}
示例6: runAssertionBean
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
private void runAssertionBean(EPServiceProvider epService) {
epService.getEPAdministrator().getConfiguration().addEventType(MyIndexMappedSamplerBean.class);
EPStatement stmt = epService.getEPAdministrator().createEPL("select * from MyIndexMappedSamplerBean");
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
epService.getEPRuntime().sendEvent(new MyIndexMappedSamplerBean());
EventBean event = listener.assertOneGetNewAndReset();
EventType type = event.getEventType();
assertEquals(2, type.getGetterIndexed("listOfInt").get(event, 1));
assertEquals(2, type.getGetterIndexed("iterableOfInt").get(event, 1));
}
示例7: runAssertionWrapper
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
private void runAssertionWrapper(EPServiceProvider epService) {
epService.getEPAdministrator().getConfiguration().addEventType(SupportBean.class);
EPStatement stmt = epService.getEPAdministrator().createEPL("select {1, 2} as arr, *, Collections.singletonMap('A', 2) as mapped from SupportBean");
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
epService.getEPRuntime().sendEvent(new SupportBean());
EventBean event = listener.assertOneGetNewAndReset();
EventType type = event.getEventType();
assertEquals(2, type.getGetterIndexed("arr").get(event, 1));
assertEquals(2, type.getGetterMapped("mapped").get(event, "A"));
stmt.destroy();
}
示例8: getOADynamicProp
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
/**
* NOTE: Code-generation-invoked method, method name and parameter order matters
* @param eventBean bean
* @param propertyName props
* @return value
* @throws PropertyAccessException exception
*/
public static Object getOADynamicProp(EventBean eventBean, String propertyName) throws PropertyAccessException {
ObjectArrayEventType objectArrayEventType = (ObjectArrayEventType) eventBean.getEventType();
Integer index = objectArrayEventType.getPropertiesIndexes().get(propertyName);
if (index == null) {
return null;
}
Object[] theEvent = (Object[]) eventBean.getUnderlying();
return theEvent[index];
}
示例9: marshal
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
public Message marshal(EventBean eventBean, Session session,
long timestamp) throws EPException {
EventType eventType = eventBean.getEventType();
MapMessage mapMessage = null;
try {
mapMessage = session.createMapMessage();
String[] properties = eventType.getPropertyNames();
for (String property : properties) {
if ((ExecutionPathDebugLog.isDebugEnabled) && (log.isDebugEnabled())) {
log.debug(
".Marshal EventProperty property==" + property + ", value=" +
eventBean.get(property));
}
Class clazz = eventType.getPropertyType(property);
if (JavaClassHelper.isNumeric(clazz)) {
Class boxedClazz = JavaClassHelper.getBoxedType(clazz);
if (boxedClazz == Double.class) {
mapMessage.setDouble(property, (Double) eventBean.get(property));
}
if (boxedClazz == Float.class) {
mapMessage.setFloat(property, (Float) eventBean.get(property));
}
if (boxedClazz == Byte.class) {
mapMessage.setFloat(property, (Byte) eventBean.get(property));
}
if (boxedClazz == Short.class) {
mapMessage.setShort(property, (Short) eventBean.get(property));
}
if (boxedClazz == Integer.class) {
mapMessage.setInt(property, (Integer) eventBean.get(property));
}
if (boxedClazz == Long.class) {
mapMessage.setLong(property, (Long) eventBean.get(property));
}
} else if ((clazz == boolean.class) || (clazz == Boolean.class)) {
mapMessage.setBoolean(property, (Boolean) eventBean.get(property));
} else if ((clazz == Character.class) || (clazz == char.class)) {
mapMessage.setChar(property, (Character) eventBean.get(property));
} else if (clazz == String.class) {
mapMessage.setString(property, (String) eventBean.get(property));
} else {
mapMessage.setObject(property, eventBean.get(property));
}
}
mapMessage.setJMSTimestamp(timestamp);
} catch (JMSException ex) {
throw new EPException(ex);
}
return mapMessage;
}
示例10: isExistsOADynamicProp
import com.espertech.esper.client.EventBean; //导入方法依赖的package包/类
/**
* NOTE: Code-generation-invoked method, method name and parameter order matters
* @param eventBean bean
* @param propertyName name
* @return flag
*/
public static boolean isExistsOADynamicProp(EventBean eventBean, String propertyName) {
ObjectArrayEventType objectArrayEventType = (ObjectArrayEventType) eventBean.getEventType();
Integer index = objectArrayEventType.getPropertiesIndexes().get(propertyName);
return index != null;
}