Skip to content

Commit

Permalink
feat(plugins): allow config to be super class on extension
Browse files Browse the repository at this point in the history
This is done in order to use the following pf4j feature with a configurable extension.
"Support any interface as an ExtensionPoint" pf4j/pf4j#350

This is nice because I can extend something that is not an extension point, and even do it in safe mode. The problem is that now my extension can only have one interface. So I can't use the ConfigurableExtension directly. I can only have one interface unless pf4j is modified to allow more.
Using my one super class slot for configuration is still not ideal, but it works. It might be nice to allow some other mechanism for config other than class hierarchy or modify pf4j to handle config natively.
  • Loading branch information
claymccoy committed Dec 16, 2019
1 parent 8c3d8e4 commit 6eaee6d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ class SpringExtensionFactory(
ResolvableType.forInstance(extension)
.apply { resolve() }
.also { resolvedType ->
resolvedType.interfaces.find { ConfigurableExtension::class.java.isAssignableFrom(it.rawClass!!) }
val parentTypes = listOf<ResolvableType>(resolvedType.superType) + resolvedType.interfaces
parentTypes.find { ConfigurableExtension::class.java.isAssignableFrom(it.rawClass!!) }
?.let {
it.resolve()
it.getGeneric(0).rawClass
Expand Down

0 comments on commit 6eaee6d

Please sign in to comment.