interfacer icon indicating copy to clipboard operation
interfacer copied to clipboard

Support manual interfaces for generated empty parent classes?

Open ebrannin-bw opened this issue 2 months ago • 1 comments

I'm working with several versioned SOAP WSDLs that each generate nearly-identical classes in different packages.

For some cases, this plugin looks perfect! I love having some sort of automated duck-typing.

But these WSDLs have some empty abstract base classes that we use all over the place, like ResourceKey and ResourceValue.

Ideas:

Interface annotations

Maybe there could be an annotation on the interface, like

@Interfacer("com.whatever.v1.core.ResourceKey")
@Interfacer("com.whatever.v2.core.ResourceKey")
@Interfacer("com.whatever.v2_5.core.ResourceKey")
@Interfacer("com.whatever.v3.core.ResourceKey")
interface ResourceKey {}

or maybe even with wildcards?

@AddTo("com.whatever.v*.core.ResourceKey")
interface ResourceKey {}

POM-level mapping

(Possibly simpler, but messier to maintain)

Declare a mapping in the POM for specific classes to get specific interfaces

<manualInterfaces>
  <manualInterface>
    <class>com.whatever.v1.core.ResourceKey</class>
    <class>com.whatever.v2.core.ResourceKey</class>
    <class>com.whatever.v2_5.core.ResourceKey</class>
    <class>com.whatever.v3.core.ResourceKey</class>
    <interface>com.elsewhere.common.ResourceKey</interface>
  </manualInterface>
  ...
</manualInterfaces>

(or with wildcards, as above)

ebrannin-bw avatar Oct 28 '25 15:10 ebrannin-bw

~~🤦‍♂️ aaaaand upon further inspection, those abstract parent classes are already in a non-versioned com.whatever.common package.~~

~~I'll leave the issue open in case anyone else actually has a need like this; feel free to close it.~~

I might still have a need like this: subclasses of ResourceKey basically all duck-type to the same interface (like String getName()), but I'm trying to find a way to have version-agnostic common code without losing the distinction between ThisResouceKey and ThatResourceKey.

ebrannin-bw avatar Oct 28 '25 15:10 ebrannin-bw