forked from finos/vuu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finos#1167 move
buildQueryEntity
to ignite-plugin for better reuse
- invloves related refactoring and clean-ups in apache-ignite example.
- Loading branch information
1 parent
2c9dd77
commit 44b5f6d
Showing
10 changed files
with
50 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...e-ignite/src/main/scala/org/finos/vuu/example/ignite/utils/getListToObjectConverter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.finos.vuu.example.ignite.utils | ||
|
||
object getListToObjectConverter { | ||
def apply[ReturnType](obj: Object): List[_] => ReturnType = { | ||
val converter = obj.getClass.getMethods.find(x => x.getName == "apply" && x.isBridge).get | ||
values => converter.invoke(obj, values.map(_.asInstanceOf[AnyRef]): _*).asInstanceOf[ReturnType] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...ite/src/test/scala/org/finos/vuu/example/ignite/schema/getListToObjectConverterTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.finos.vuu.example.ignite.schema | ||
|
||
import org.finos.vuu.example.ignite.utils.getListToObjectConverter | ||
import org.scalatest.featurespec.AnyFeatureSpec | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
class getListToObjectConverterTest extends AnyFeatureSpec with Matchers { | ||
|
||
Feature("getListToObjectConverterTest") { | ||
Scenario("Can build Dto from a list of values") { | ||
val dto = getListToObjectConverter[TestDto](TestDto)(List("TestObject", 25.5)) | ||
|
||
dto shouldEqual TestDto(name = "TestObject", value = 25.5) | ||
} | ||
} | ||
|
||
private case class TestDto(name: String, value: Double) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters