/*
* *************************************************************************************
* Copyright (C) 2008 EsperTech, Inc. All rights reserved. *
* http://esper.codehaus.org *
* http://www.espertech.com *
* ---------------------------------------------------------------------------------- *
* The software in this package is published under the terms of the GPL license *
* a copy of which has been included with this distribution in the license.txt file. *
* *************************************************************************************
*/
package com.espertech.esper.epl.enummethod.dot;
import com.espertech.esper.client.EventBean;
import com.espertech.esper.client.EventPropertyGetter;
import com.espertech.esper.client.EventType;
import com.espertech.esper.epl.expression.ExprEvaluatorContext;
import com.espertech.esper.epl.expression.ExprEvaluatorEnumeration;
import com.espertech.esper.epl.expression.ExprValidationException;
import com.espertech.esper.event.EventAdapterService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.Collection;
public class PropertyExprEvaluatorScalarCollection implements ExprEvaluatorEnumeration {
private static final Log log = LogFactory.getLog(PropertyExprEvaluatorScalarCollection.class);
private final String propertyName;
private final int streamId;
private final EventPropertyGetter getter;
private final Class componentType;
public PropertyExprEvaluatorScalarCollection(String propertyName, int streamId, EventPropertyGetter getter, Class componentType) {
this.propertyName = propertyName;
this.streamId = streamId;
this.getter = getter;
this.componentType = componentType;
}
public Collection<EventBean> evaluateGetROCollectionEvents(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext context) {
return null;
}
public Collection evaluateGetROCollectionScalar(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext context) {
EventBean eventInQuestion = eventsPerStream[streamId];
Object result = getter.get(eventInQuestion);
if (result == null) {
return null;
}
if (!(result instanceof Collection)) {
log.warn("Expected collection-type input from property '" + propertyName + "' but received " + result.getClass());
return null;
}
return (Collection) getter.get(eventInQuestion);
}
public EventType getEventTypeCollection(EventAdapterService eventAdapterService) {
return null;
}
public Class getComponentTypeCollection() throws ExprValidationException {
return componentType;
}
public EventType getEventTypeSingle(EventAdapterService eventAdapterService, String statementId) throws ExprValidationException {
return null;
}
public EventBean evaluateGetEventBean(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext context) {
return null;
}
}