Github user takezoe commented on a diff in the pull request:
https://github.com/apache/incubator-predictionio/pull/387#discussion_r120153688
--- Diff:
data/src/main/scala/org/apache/predictionio/data/storage/Storage.scala ---
@@ -306,9 +306,18 @@ object Storage extends Logging {
}
val constructor = clazz.getConstructors()(0)
try {
- constructor.newInstance(ctorArgs: _*).
+ val instance = constructor.newInstance(ctorArgs: _*).
asInstanceOf[T]
+ try {
+ val init = instance.getClass.getMethod("init")
+ init.invoke(instance)
--- End diff --
In my opinion, if `init()` method is necessary for data objects, we should
define a trait (e.g. `Initializable`) which has a `init()` method and cast by
pattern match here to call `init()` method.
But since this is just my thought, we need opinion from other committers as
well.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---