Exemplo n.º 1
0
 public EventBean AdapterForObjectArray(
     object[] theEvent,
     string eventTypeName)
 {
     var eventType = FindType(eventTypeName);
     return typedEventFactory.AdapterForTypedObjectArray(theEvent, eventType);
 }
        public EventBean Copy(EventBean theEvent)
        {
            var arrayBacked = (ObjectArrayBackedEventBean) theEvent;
            var props = arrayBacked.Properties;
            var shallowCopy = new object[props.Length];
            Array.Copy(props, 0, shallowCopy, 0, props.Length);

            foreach (var index in mapIndexesToCopy) {
                var innerMap = (IDictionary<string, object>) shallowCopy[index];
                if (innerMap != null) {
                    var copy = new Dictionary<string, object>(innerMap);
                    shallowCopy[index] = copy;
                }
            }

            foreach (var index in arrayIndexesToCopy) {
                var array = shallowCopy[index] as Array;
                if (array != null && array.Length != 0) {
                    var elementType = array.GetType().GetElementType();
                    var copied = Arrays.CreateInstanceChecked(elementType, array.Length);
                    array.CopyTo(copied, 0);
                    shallowCopy[index] = copied;
                }
            }

            return eventAdapterService.AdapterForTypedObjectArray(shallowCopy, eventType);
        }
 public EventBean Copy(EventBean theEvent)
 {
     var array = ((ObjectArrayBackedEventBean) theEvent).Properties;
     var copy = new object[array.Length];
     Array.Copy(array, 0, copy, 0, copy.Length);
     return eventAdapterService.AdapterForTypedObjectArray(copy, objectArrayEventType);
 }
Exemplo n.º 4
0
        public void SendEvent(object theEvent)
        {
            if (!theEvent.GetType().IsArray) {
                throw new EPException(
                    "Unexpected event object of type " + theEvent.GetType().CleanName() + ", expected Object[]");
            }

            var arr = (object[]) theEvent;
            EventBean objectArrayEvent =
                eventBeanTypedEventFactory.AdapterForTypedObjectArray(arr, objectArrayEventType);

            if (threadingService.IsInboundThreading) {
                threadingService.SubmitInbound(objectArrayEvent, runtimeEventSender);
            }
            else {
                runtimeEventSender.ProcessWrappedEvent(objectArrayEvent);
            }
        }
        public override object HandleNestedValueFragment(object value)
        {
            if (!(value is object[])) {
                if (value is EventBean) {
                    return arrayGetter.GetFragment((EventBean) value);
                }

                return null;
            }

            // If the map does not contain the key, this is allowed and represented as null
            EventBean eventBean = EventBeanTypedEventFactory.AdapterForTypedObjectArray((object[]) value, FragmentType);
            return arrayGetter.GetFragment(eventBean);
        }
Exemplo n.º 6
0
        /// <summary>
        ///     NOTE: Code-generation-invoked method, method name and parameter order matters
        /// </summary>
        /// <param name="props">props</param>
        /// <param name="eventBeanToObjectIndexes">indexes</param>
        /// <param name="eventBeanTypedEventFactory">svc</param>
        /// <param name="resultEventType">type</param>
        /// <returns>bean</returns>
        public static EventBean ProcessSelectExprbeanToObjArray(
            object[] props,
            int[] eventBeanToObjectIndexes,
            EventBeanTypedEventFactory eventBeanTypedEventFactory,
            EventType resultEventType)
        {
            foreach (var propertyIndex in eventBeanToObjectIndexes) {
                var value = props[propertyIndex];
                if (value is EventBean) {
                    props[propertyIndex] = ((EventBean) value).Underlying;
                }
            }

            return eventBeanTypedEventFactory.AdapterForTypedObjectArray(props, resultEventType);
        }
Exemplo n.º 7
0
        /// <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">service</param>
        /// <returns>fragment</returns>
        public static object HandleBNCreateFragmentObjectArray(
            object value,
            EventType fragmentEventType,
            EventBeanTypedEventFactory eventBeanTypedEventFactory)
        {
            if (!(value is object[])) {
                if (value is EventBean) {
                    return value;
                }

                return null;
            }

            var subEvent = (object[]) value;
            return eventBeanTypedEventFactory.AdapterForTypedObjectArray(subEvent, fragmentEventType);
        }
Exemplo n.º 8
0
        /// <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);
        }
Exemplo n.º 9
0
        public static object HandleNestedValueArrayWithObjectArrayFragment(
            object value,
            int index,
            ObjectArrayEventPropertyGetter getter,
            EventType fragmentType,
            EventBeanTypedEventFactory eventBeanTypedEventFactory)
        {
            var valueArray = GetBNArrayValueAtIndex(value, index);
            if (!(valueArray is object[])) {
                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.AdapterForTypedObjectArray((object[]) valueArray, fragmentType);
            return getter.GetFragment(eventBean);
        }
Exemplo n.º 10
0
 public EventBean Wrap(object underlying)
 {
     return eventBeanTypedEventFactory.AdapterForTypedObjectArray((object[]) underlying, type);
 }
 public EventBean Make(object[] properties)
 {
     var cols = MakeUnderlying(properties);
     return eventAdapterService.AdapterForTypedObjectArray(cols, eventType);
 }