-
Notifications
You must be signed in to change notification settings - Fork 46
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
refactor: refactored FeelEngineBuilder to be available from java/kotlin #832
base: main
Are you sure you want to change the base?
Conversation
Mh.. not sure what causes this:
|
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.
@vicmosin thank you for your contribution. 🎉 I added a few comments to improve the solution. Please have a look. 🍪
object FeelEngineBuilder { | ||
|
||
@javaStatic | ||
def create(): FeelEngineBuilder = FeelEngineBuilder() |
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.
👍 Nice.
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.
🔧 Additionally, we could create a convenient method for Java applications. Usually, every Java application will use the JavaValueMapper.
For example:
def forJava(): FeelEngineBuilder = FeelEngineBuilder().withCustomValueMapper(new JavaValueMapper)
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.
@saig0 tbh I am not sure I really understood your idea about forJava
method.. Could you please elaborate?
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 idea is to make it easier for Java applications. Currently, a Java application must set the JavaValueMapper
to transform collections into Java types. Otherwise, the engine returns Scala types.
By providing a convenient method, a Java application doesn't need to set the value mapper itself and doesn't depend on it. Less failure points.
class FeelEngineBuilderTest extends AnyFlatSpec with Matchers { | ||
|
||
"A FeelEngineBuilder" should "successfully build a FeelEngineApi instance" in { | ||
val engine: FeelEngineApi = FeelEngineBuilder.create().build() |
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.
🔧 To verify that the builder is working from Java code, it would be best to use the builder in a Java class. In the Scala test, we could call the Java class and verify that it can build an engine.
@vicmosin do you want to continue contributing to this PR? The last update was one month ago. |
@saig0 I am sorry, I've been busy last month, will be available at the beginning of the june. If it's urgent, feel free to take over. Thnx |
@vicmosin thank you for the update. 👍 No need to rush. June is fine. 🌞 |
Description
Refactored implementation
Related issues
closes #724