本文整理匯總了Java中com.espertech.esper.epl.variable.VariableReader.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java VariableReader.getValue方法的具體用法?Java VariableReader.getValue怎麽用?Java VariableReader.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.espertech.esper.epl.variable.VariableReader
的用法示例。
在下文中一共展示了VariableReader.getValue方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getCheckMetadataVariable
import com.espertech.esper.epl.variable.VariableReader; //導入方法依賴的package包/類
private static MethodMetadataDesc getCheckMetadataVariable(String methodName, VariableMetaData variableMetaData, VariableReader variableReader, EngineImportService engineImportService, Class metadataClass)
throws ExprValidationException {
Method typeGetterMethod = getRequiredTypeGetterMethodCanNonStatic(methodName, null, variableMetaData.getType(), engineImportService, metadataClass);
if (Modifier.isStatic(typeGetterMethod.getModifiers())) {
return invokeMetadataMethod(null, variableMetaData.getClass().getSimpleName(), typeGetterMethod);
}
// if the metadata is not a static method and we don't have an instance this is a problem
String messagePrefix = "Failed to access variable method invocation metadata: ";
if (variableReader == null) {
throw new ExprValidationException(messagePrefix + "The metadata method is an instance method however the variable is contextual, please declare the metadata method as static or remove the context declaration for the variable");
}
Object value = variableReader.getValue();
if (value == null) {
throw new ExprValidationException(messagePrefix + "The variable value is null and the metadata method is an instance method");
}
if (value instanceof EventBean) {
value = ((EventBean) value).getUnderlying();
}
return invokeMetadataMethod(value, variableMetaData.getClass().getSimpleName(), typeGetterMethod);
}
示例2: getVariableValue
import com.espertech.esper.epl.variable.VariableReader; //導入方法依賴的package包/類
public Object getVariableValue(String variableName) throws EPException {
services.getVariableService().setLocalVersion();
VariableMetaData metaData = services.getVariableService().getVariableMetaData(variableName);
if (metaData == null) {
throw new VariableNotFoundException("Variable by name '" + variableName + "' has not been declared");
}
if (metaData.getContextPartitionName() != null) {
throw new VariableNotFoundException("Variable by name '" + variableName + "' has been declared for context '" + metaData.getContextPartitionName() + "' and cannot be read without context partition selector");
}
VariableReader reader = services.getVariableService().getReader(variableName, EPStatementStartMethod.DEFAULT_AGENT_INSTANCE_ID);
Object value = reader.getValue();
if (value == null || reader.getVariableMetaData().getEventType() == null) {
return value;
}
return ((EventBean) value).getUnderlying();
}
示例3: getVariableValue
import com.espertech.esper.epl.variable.VariableReader; //導入方法依賴的package包/類
public Map<String, Object> getVariableValue(Set<String> variableNames) throws EPException
{
services.getVariableService().setLocalVersion();
Map<String, Object> values = new HashMap<String, Object>();
for (String variableName : variableNames)
{
VariableReader reader = services.getVariableService().getReader(variableName);
if (reader == null)
{
throw new VariableNotFoundException("Variable by name '" + variableName + "' has not been declared");
}
Object value = reader.getValue();
if (value != null && reader.getEventType() != null) {
value = ((EventBean) value).getUnderlying();
}
values.put(variableName, value);
}
return values;
}
示例4: evaluate
import com.espertech.esper.epl.variable.VariableReader; //導入方法依賴的package包/類
public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext) {
VariableReader reader;
if (readerNonCP != null) {
reader = readerNonCP;
} else {
reader = readersPerCp.get(exprEvaluatorContext.getAgentInstanceId());
}
if (InstrumentationHelper.ENABLED) {
InstrumentationHelper.get().qExprVariable(this);
}
Object value = reader.getValue();
if (isPrimitive || value == null) {
if (InstrumentationHelper.ENABLED) {
InstrumentationHelper.get().aExprVariable(value);
}
return value;
}
EventBean theEvent = (EventBean) value;
if (optSubPropName == null) {
if (InstrumentationHelper.ENABLED) {
InstrumentationHelper.get().aExprVariable(theEvent.getUnderlying());
}
return theEvent.getUnderlying();
}
Object result = eventTypeGetter.get(theEvent);
if (InstrumentationHelper.ENABLED) {
InstrumentationHelper.get().aExprVariable(result);
}
return result;
}
示例5: invokeInternalVariable
import com.espertech.esper.epl.variable.VariableReader; //導入方法依賴的package包/類
private List<EventBean> invokeInternalVariable(Object[] lookupValues, VariableReader variableReader) {
Object target = variableReader.getValue();
if (target == null) {
return null;
}
if (target instanceof EventBean) {
target = ((EventBean) target).getUnderlying();
}
return invokeInternal(lookupValues, target);
}