public EventBean copy(EventBean theEvent) { ObjectArrayBackedEventBean arrayBacked = (ObjectArrayBackedEventBean) theEvent; Object[] props = arrayBacked.getProperties(); Object[] shallowCopy = new Object[props.length]; System.arraycopy(props, 0, shallowCopy, 0, props.length); for (int index : mapIndexesToCopy) { Map<String, Object> innerMap = (Map<String, Object>) shallowCopy[index]; if (innerMap != null) { Map copy = new HashMap<String, Object>(innerMap); shallowCopy[index] = copy; } } for (int index : arrayIndexesToCopy) { Object array = shallowCopy[index]; if (array != null && array.getClass().isArray() && Array.getLength(array) != 0) { Object copied = Array.newInstance(array.getClass().getComponentType(), Array.getLength(array)); System.arraycopy(array, 0, copied, 0, Array.getLength(array)); shallowCopy[index] = copied; } } return eventAdapterService.adapterForTypedObjectArray(shallowCopy, eventType); }
public EventBean process( EventBean[] eventsPerStream, boolean isNewData, boolean isSynthesize, ExprEvaluatorContext exprEvaluatorContext) { ObjectArrayBackedEventBean theEvent = (ObjectArrayBackedEventBean) eventsPerStream[0]; return eventAdapterService.adapterForTypedObjectArray( theEvent.getProperties(), resultEventType); }