public EventBean AdapterForMap( IDictionary<string, object> theEvent, string eventTypeName) { var eventType = FindType(eventTypeName); return typedEventFactory.AdapterForTypedMap(theEvent, eventType); }
public object Get(EventBean theEvent) { if (!(theEvent is DecoratingEventBean)) { throw new PropertyAccessException("Mismatched property getter to EventBean type"); } var wrapperEvent = (DecoratingEventBean) theEvent; var map = wrapperEvent.DecoratingProperties; return mapGetter.Get(eventBeanTypedEventFactory.AdapterForTypedMap(map, underlyingMapType)); }
public EventBean Copy(EventBean theEvent) { var mapped = (MappedEventBean) theEvent; var props = mapped.Properties; var shallowCopy = new Dictionary<string, object>(props); foreach (var name in mapPropertiesToCopy) { var innerMap = (IDictionary<string, object>) props.Get(name); if (innerMap != null) { var copy = new Dictionary<string, object>(innerMap); shallowCopy.Put(name, copy); } } foreach (var name in arrayPropertiesToCopy) { var raw = props.Get(name); if (raw is Array array && array.Length != 0) { var elementType = array.GetType().GetElementType(); var copied = Arrays.CreateInstanceChecked(elementType, array.Length); Array.Copy(array, 0, copied, 0, array.Length); shallowCopy.Put(name, copied); } } return eventBeanTypedEventFactory.AdapterForTypedMap(shallowCopy, mapEventType); }
public void SendEvent(object theEvent) { if (!(theEvent is IDictionary<string, object>)) { throw new EPException( "Unexpected event object of type " + theEvent.GetType().CleanName() + ", expected " + typeof(IDictionary<string, object>).CleanName()); } var map = (IDictionary<string, object>) theEvent; EventBean mapEvent = eventBeanTypedEventFactory.AdapterForTypedMap(map, mapEventType); if (threadingService.IsInboundThreading) { threadingService.SubmitInbound(mapEvent, runtimeEventSender); } else { runtimeEventSender.ProcessWrappedEvent(mapEvent); } }
/// <summary> /// Populate bean. /// </summary> /// <param name="baseStatisticsBean">results</param> /// <param name="eventAdapterService">event wrapping</param> /// <param name="eventType">type to produce</param> /// <param name="additionalProps">addition properties</param> /// <param name="decoration">decoration values</param> /// <returns>bean</returns> public static EventBean DoPopulateMap( BaseStatisticsBean baseStatisticsBean, EventBeanTypedEventFactory eventAdapterService, EventType eventType, StatViewAdditionalPropsEval additionalProps, object[] decoration) { IDictionary<string, object> result = new Dictionary<string, object>(); result.Put(ViewFieldEnum.CORRELATION__CORRELATION.GetName(), baseStatisticsBean.Correlation); additionalProps?.AddProperties(result, decoration); return eventAdapterService.AdapterForTypedMap(result, eventType); }
/// <summary> /// NOTE: Code-generation-invoked method, method name and parameter order matters /// </summary> /// <param name="props">props</param> /// <param name="eventBeanToObjectProps">indexes</param> /// <param name="eventAdapterService">svc</param> /// <param name="resultEventType">type</param> /// <returns>bean</returns> public static EventBean ProcessSelectExprbeanToMap( IDictionary<string, object> props, string[] eventBeanToObjectProps, EventBeanTypedEventFactory eventAdapterService, EventType resultEventType) { foreach (var property in eventBeanToObjectProps) { var value = props.Get(property); if (value is EventBean) { props.Put(property, ((EventBean) value).Underlying); } } return eventAdapterService.AdapterForTypedMap(props, resultEventType); }
/// <summary> /// NOTE: Code-generation-invoked method, method name and parameter order matters /// </summary> /// <param name="value">value</param> /// <param name="fragmentEventType">fragment type</param> /// <param name="eventBeanTypedEventFactory">event adapter service</param> /// <returns>fragment</returns> public static object HandleBNCreateFragmentMap( object value, EventType fragmentEventType, EventBeanTypedEventFactory eventBeanTypedEventFactory) { if (!(value is Map)) { if (value is EventBean) { return value; } return null; } var subEvent = (Map) value; return eventBeanTypedEventFactory.AdapterForTypedMap(subEvent, fragmentEventType); }
public override object HandleNestedValueFragment(object value) { if (!(value is IDictionary<string, object>)) { if (value is EventBean) { return mapGetter.GetFragment((EventBean) value); } return null; } // If the map does not contain the key, this is allowed and represented as null EventBean eventBean = EventBeanTypedEventFactory.AdapterForTypedMap( (IDictionary<string, object>) value, FragmentType); return mapGetter.GetFragment(eventBean); }
/// <summary> /// NOTE: Code-generation-invoked method, method name and parameter order matters /// </summary> /// <param name="value">value</param> /// <param name="fragmentEventType">fragment type</param> /// <param name="eventBeanTypedEventFactory">svc</param> /// <returns>fragment</returns> public static object GetBNFragmentArray( object value, EventType fragmentEventType, EventBeanTypedEventFactory eventBeanTypedEventFactory) { if (value is Map[]) { var mapTypedSubEvents = (Map[]) value; var countNull = 0; foreach (var map in mapTypedSubEvents) { if (map != null) { countNull++; } } var mapEvents = new EventBean[countNull]; var count = 0; foreach (var map in mapTypedSubEvents) { if (map != null) { mapEvents[count++] = eventBeanTypedEventFactory.AdapterForTypedMap(map, fragmentEventType); } } return mapEvents; } if (value is Array subEvents) { var countNullX = 0; foreach (var subEvent in subEvents) { if (subEvent != null) { countNullX++; } } var outEvents = new EventBean[countNullX]; var countX = 0; foreach (var item in subEvents) { if (item != null) { outEvents[countX++] = GetBNFragmentNonPono(item, fragmentEventType, eventBeanTypedEventFactory); } } return outEvents; } return null; }
/// <summary> /// NOTE: Code-generation-invoked method, method name and parameter order matters /// </summary> /// <param name="fragmentUnderlying">fragment</param> /// <param name="fragmentEventType">type</param> /// <param name="eventBeanTypedEventFactory">svc</param> /// <returns>bean</returns> public static EventBean GetBNFragmentNonPono( object fragmentUnderlying, EventType fragmentEventType, EventBeanTypedEventFactory eventBeanTypedEventFactory) { if (fragmentUnderlying == null) { return null; } if (fragmentEventType is MapEventType) { return eventBeanTypedEventFactory.AdapterForTypedMap( (IDictionary<string, object>) fragmentUnderlying, fragmentEventType); } return eventBeanTypedEventFactory.AdapterForTypedObjectArray( (object[]) fragmentUnderlying, fragmentEventType); }
public static object HandleBNNestedValueArrayWithMapFragment( object value, int index, MapEventPropertyGetter getter, EventBeanTypedEventFactory eventBeanTypedEventFactory, EventType fragmentType) { var valueMap = GetBNArrayValueAtIndex(value, index); if (!(valueMap is Map)) { if (value is EventBean) { return getter.GetFragment((EventBean) value); } return null; } // If the map does not contain the key, this is allowed and represented as null EventBean eventBean = eventBeanTypedEventFactory.AdapterForTypedMap( (IDictionary<string, object>) valueMap, fragmentType); return getter.GetFragment(eventBean); }
public EventBean Wrap(object underlying) { return eventBeanTypedEventFactory.AdapterForTypedMap((IDictionary<string, object>) underlying, type); }
public EventBean Copy(EventBean theEvent) { var mapped = (MappedEventBean) theEvent; var props = mapped.Properties; return eventAdapterService.AdapterForTypedMap(new Dictionary<string, object>(props), mapEventType); }
public EventBean Make(object[] properties) { var values = MakeUnderlying(properties); return eventAdapterService.AdapterForTypedMap(values, mapEventType); }