Expose data of non-Jenkins library classes via remote API

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Expose data of non-Jenkins library classes via remote API

Ulli Hafner
I want to expose data using the remote API for classes that I cannot change (or that should not depend on Jenkins), is there a way to expose these properties as well?

E.g. I have

@ExportedBean
class Bean {
  @Exported
  public String name;
  @Exported
  public ClassFromLibrary getFoo() { ... };
}

This is serialized to

<bean>
  <name>Hello World</name>
  <foo/>
</bean>

<foo/> remains empty since no property of ClassFromLibrary is annotated with @Exported.

Or is the only way to extend from ClassFromLibrary and overwrite each interesting getter with the @Exported annotation?

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/66443FC6-DD2C-4A5D-9D59-AD7D883AFB3A%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc (540 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Expose data of non-Jenkins library classes via remote API

Jesse Glick-4
On Fri, Jun 1, 2018 at 5:30 PM, Ullrich Hafner <[hidden email]> wrote:
> I want to expose data using the remote API for classes that I cannot change (or that should not depend on Jenkins), is there a way to expose these properties as well?

Subclassing is evil. Create new POJOs in your plugin which mirror the
relevant aspects of the external library and export whatever.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2hOQkJ-q6%3Dx%2B_X-_1ddPhXhXJgB6zHwrFghweB0eRvew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.