> `@ExportedBean` you mean? Or `@Exported`? These annotations cannot be
used on interfaces or interface methods.

Well that explains that and certain other related questions

I'm now handling interfaces specifically in a different way (Making a fake
graphql "type" that implements the interface as a fallback)

> Sounds like a question about GraphQL,

Its a bit of all 3. Stapler works somewhat in runtime, looking at the
annotations of the actual class, graphql you need to define the schema
before the query is executed. Ideally even before its sent. When its still
being built. So i'm having to shift my designs a bit.

For the most part I have something basic working that gets data. Right now
I'm using ExtensionList's TopLevelDescriptor to find all the job types, and
then building a graphql schema from those. Its working beautifully, but
some of the lower level objects I'm unsure how to handle.

For example. FreeStyleProject/AbstractProject has getAllActions() exported
as Actions, which I've gotten working in graphql, but I lose the ability to
have per instance exports.

Since action is not an extension point, they are not annotated with
@Extension, so Is there a another way to get this? Even a slow way cause
i'm just doing it on startup. I've been trying to google for various ways
to get all the classes that implement an implementation but not really
having much luck. As far as I can tell, stapler doesn't have a master list,
it just has a cache it uses when you ask for the model -
https://github.com/stapler/stapler/blob/master/core/src/main/java/org/kohsuke/stapler/export/ModelBuilder.java

Okay, since i started writing this, I found out about the reflections
class/library.

so I think I can do as follows, which is probably a little expensive (And
fairly slow, had to limit it to just hudson/jenkins package names), but is
only done on startup:

```
            for (Package pkg :  Package.getPackages()) {
                if (pkg.getName().toLowerCase().contains("jenkins") ||
pkg.getName().toLowerCase().contains("hudson")) {
                    Reflections reflections = new
Reflections(pkg.getName());
                    classQueue.addAll(reflections.getSubTypesOf(clazz));
                }
            }
```

Is there a better way of doing this? Can I find all classes that are
@Exported?

Gavin





On Fri, May 31, 2019 at 7:30 AM Jesse Glick <[email protected]> wrote:

> On Fri, May 31, 2019 at 3:17 AM 'Gavin Mogan' via Jenkins Developers
> <[email protected]> wrote:
> > From a stapler point of view I have a few questions about RunWithSCM and
> other job interfaces.
> >
> > 1) Is there any reason its not exported? I'm assuming because the
> classes that actually implement it are exported?
>
> `@ExportedBean` you mean? Or `@Exported`? These annotations cannot be
> used on interfaces or interface methods.
>
> > 2) Is there anything special about RunWithSCM and its kin that would
> help me find other useful implementations?
>
> Can you be more explicit?
>
> > With graphql, when fetching data, as I understand it, you need to say
> how to handle subclasses.
>
> Sounds like a question about GraphQL, or its Java bindings (that mixin
> interfaces are not well supported), rather than about Jenkins per se.
>
> >    ... on FreeStyleProject { // scm stuff (legacy) }
> >    ... on RunWithSCM { // modern scm stuff  }
>
> In this case `AbstractBuild` is retrofitted to implement `RunWithSCM`
> so the first clause would not be necessary.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-dev/RklYADD2uKc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0cwe28ORgJDUnwTZu0Ls-%2BY4RHcQ3DAVbvxkYAU9f5oQ%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAG%3D_DuvW5m4T%3DTLu55y0vw3WdBt%2BeNodDwCaTst0TDmmgVp0zA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to