[
https://issues.apache.org/jira/browse/APEXMALHAR-1972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15096099#comment-15096099
]
ASF GitHub Bot commented on APEXMALHAR-1972:
--------------------------------------------
Github user shubham-pathak22 commented on a diff in the pull request:
https://github.com/apache/incubator-apex-malhar/pull/170#discussion_r49583462
--- Diff:
library/src/main/java/com/datatorrent/lib/expressions/ExpressionEvaluator.java
---
@@ -0,0 +1,440 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.datatorrent.lib.expressions;
+
+import org.codehaus.commons.compiler.CompilerFactoryFactory;
+import org.codehaus.commons.compiler.IScriptEvaluator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * This class is used for evaluating expressions which takes multiple
parameter object and the result is returned for that expression.
+ *
+ * The way to reference a variable in an object is ${placeholder.varname}.
+ * The variable will be resolved to its accessible variable or getter
method in order. After this the variable can be used as if its a Java variable.
+ *
+ * ExpressionEvaluator also allows you to set extra imports that needs to
be added over default is java.lang.*
+ *
+ * ExpressionEvaluator needs to be configured with following
configurations as minimal configuration:
+ * 1. Mapping of input object place holders to it corresponding types.
+ * This can be done with setInputObjectPlaceholders method.
+ * 2. Return type of of expression evaluation.
+ * 3. Expression to be evaluated. This is a standard java expression
except for referencing the variable inside object JEL syntax needs to be used
i.e. ${objectPlaceHolder.varName}
+ *
+ * Expression cab be defined as per JSL 7 syntax:
--- End diff --
can
> Create Expression Evaluator Support quasi-Java Expression Language
> ------------------------------------------------------------------
>
> Key: APEXMALHAR-1972
> URL: https://issues.apache.org/jira/browse/APEXMALHAR-1972
> Project: Apache Apex Malhar
> Issue Type: New Feature
> Components: utilities
> Reporter: Chinmay Kolhatkar
> Assignee: Chinmay Kolhatkar
>
> Create Expression Evaluator utility which will have support for quasi-Java
> expression language.
> Usecases, Design, etc need to be added as a comment.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)