I want to write a Scala function like
def functionA(objectMap:Map[String, ClassB], statements: List[String]): ClassB = {
var retObj = new ClassB
retObj = statements
return retObj
}
Input of this function are:
1) objectMap(Map[String, ClassB)] which is Map having objectIdentifier as key and object as Value, e.g.
Map[{"object1": An instance of class ClassB},
{"object2": An instance of class ClassB},
{"object3": An instance of class ClassB}]]
2) statements (List[String]), which is Scala code coming from configuration like
val tmpOb1 = <object1>.join(<object2>)
val tmpOb2 = <object3>.sum(tmpOb1)
Now what I want from functionA is to parse the statements, replace placeholders like "<object*>"
from real object, taken from objectMap and execute the statements.
How can I achieve the same?
Scala Version: 2.11
Spark: 2.2.1