You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I guess this came up before, but anyways :) I want to be able to inject generic implementations and right now Magnet hinders me to do that because of some class name validation issue:
constvalRATINGS_STORAGE="ratings-storage"data classRatingsModel(...)
interfaceModelStore<T> {
funload(): T?funsave(data:T)
}
@Instance(type =ModelStore::class, classifier =RATINGS_STORAGE)
funprovideRatingsModelStore(): ModelStore<RatingsModel> {
return/* create the store for the RatingsModel */
}
}
@Instance(type =RatingsManager::class)
classRatingsManager internal constructor(
@Classifier(RATINGS_STORAGE) privatevalstore:ModelStore<RatingsData>
) {
...
}
This fails with
error: Method must return instance of path.to.ModelStore as declared by interface magnet.Instance
public static final de.aoksystems.ma.abp.modelstore.ModelStore<RatingsData> provideRatingsModelStore()
Now I thought maybe I could outsmart the validation and use
but this didn't work either. And naturally, Kotlin doesn't let me use the plain ModelStore type without any generic arguments, as I could do with Java:
publicclassStaticProvision {
@Instance(type = ModelStore.class, classifier = RATINGS_STORAGE)
staticModelStoreprovideRatingsModelStore() {
return/* create the store for the RatingsModel */;
}
}
This version of course compiles just fine.
What are my options here (beside starting to write Java code again :))?
The text was updated successfully, but these errors were encountered:
So I guess this came up before, but anyways :) I want to be able to inject generic implementations and right now Magnet hinders me to do that because of some class name validation issue:
This fails with
Now I thought maybe I could outsmart the validation and use
but this didn't work either. And naturally, Kotlin doesn't let me use the plain
ModelStore
type without any generic arguments, as I could do with Java:This version of course compiles just fine.
What are my options here (beside starting to write Java code again :))?
The text was updated successfully, but these errors were encountered: