public void defineFunction(FunctionDefinition functionDefinition) { if (functionDefinition == null) { throw new SiddhiAppValidationException("Function Definition should not be null"); } else if (functionDefinition.getId() == null) { throw new SiddhiAppValidationException("Function Id should not be null for Function Definition", functionDefinition.getQueryContextStartIndex(), functionDefinition.getQueryContextEndIndex()); } else if (functionDefinition.getReturnType() == null) { throw new SiddhiAppValidationException("Return type should not be null for Function Definition", functionDefinition.getQueryContextStartIndex(), functionDefinition.getQueryContextEndIndex()); } else if (functionDefinition.getBody() == null) { throw new SiddhiAppValidationException("Body should not be null for Function Definition", functionDefinition.getQueryContextStartIndex(), functionDefinition.getQueryContextEndIndex()); } else if (functionDefinition.getLanguage() == null) { throw new SiddhiAppValidationException("Language should not be null for Function Definition", functionDefinition.getQueryContextStartIndex(), functionDefinition.getQueryContextEndIndex()); } checkDuplicateFunctionExist(functionDefinition); this.functionDefinitionMap.put(functionDefinition.getId(), functionDefinition); }
/** * Generates FunctionConfig from the given Siddhi FunctionDefinition * * @param functionDefinition Siddhi FunctionDefinition * @return FunctionConfig object */ public FunctionConfig generateFunctionConfig(FunctionDefinition functionDefinition) { FunctionConfig functionConfig = new FunctionConfig(functionDefinition.getId(), functionDefinition.getLanguage(), functionDefinition.getReturnType().toString(), functionDefinition.getBody()); preserveAndBindCodeSegment(functionDefinition, functionConfig); return functionConfig; } }
public void defineFunction(FunctionDefinition functionDefinition) { if (functionDefinition == null) { throw new SiddhiAppValidationException("Function Definition should not be null"); } else if (functionDefinition.getId() == null) { throw new SiddhiAppValidationException("Function Id should not be null for Function Definition", functionDefinition.getQueryContextStartIndex(), functionDefinition.getQueryContextEndIndex()); } else if (functionDefinition.getReturnType() == null) { throw new SiddhiAppValidationException("Return type should not be null for Function Definition", functionDefinition.getQueryContextStartIndex(), functionDefinition.getQueryContextEndIndex()); } else if (functionDefinition.getBody() == null) { throw new SiddhiAppValidationException("Body should not be null for Function Definition", functionDefinition.getQueryContextStartIndex(), functionDefinition.getQueryContextEndIndex()); } else if (functionDefinition.getLanguage() == null) { throw new SiddhiAppValidationException("Language should not be null for Function Definition", functionDefinition.getQueryContextStartIndex(), functionDefinition.getQueryContextEndIndex()); } checkDuplicateFunctionExist(functionDefinition); this.functionDefinitionMap.put(functionDefinition.getId(), functionDefinition); }