Expose data of non-Jenkins library classes via remote API

13 views
Skip to first unread message

Ullrich Hafner

unread,
Jun 1, 2018, 5:30:26 PM6/1/18
to Jenkins Developers
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?
signature.asc

Jesse Glick

unread,
Jun 1, 2018, 7:19:58 PM6/1/18
to Jenkins Dev
On Fri, Jun 1, 2018 at 5:30 PM, Ullrich Hafner <ullrich...@gmail.com> 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.
Reply all
Reply to author
Forward
0 new messages