-
Notifications
You must be signed in to change notification settings - Fork 0
View template modiifcations #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| if (field.getDisplay()) { | ||
| result.put(field.getTitle(), evaluator.evaluate()); | ||
| result.put(field.getTitle(), evaluator.evaluate().toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The toString here can still make 7 as "7", which is why we needed some other way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, JsonNodeFactory.instance.pojoNode(evaluator.evaluate()) using to set the object.
| @Before | ||
| public void init() { | ||
| vt = new ViewTemplate(); | ||
| FunctionDefinition fd = new FunctionDefinition(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could there be a parameterized constructor?
| String mathProblem = "{\"Math\": " + | ||
| " {\"a\": 5," + | ||
| " \"b\": 2 }}"; | ||
| ObjectNode node = (ObjectNode) new ObjectMapper().readTree(mathProblem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is duplicate code repeated in tests...if you've to add a third test, you must think of creating functions for this.
indrajra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't allow EvaluatorFactory to be hardcoded with function names.
|
|
||
| public class EvaluatorFactory { | ||
|
|
||
| public static final String concat = "concat"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MANDATORY: Why are these hardcoded here? We are creating a library and this can't be in a Factory class for sure.
Part1 changes done:
Introduced new methods to
Modified transformer method
Added test cases
deleted VTMain
Part 2 changes done-
Introduced IEvaluator: public T evaluate() and EvaluatorFactory: getInstance()