Coder Social home page Coder Social logo

Comments (7)

Shpota avatar Shpota commented on May 28, 2024 1

Thank you, I will add it once I have time.

from ktargeter.

Shpota avatar Shpota commented on May 28, 2024

Hi,

Thank you for opening this issue.

There are a couple of solutions for this. If you have a gradle plugin, you can include the ktargeter plugin as a dependency and pass ktargeter.annotations from the code of your plugin. I am not sure about the details, I would need to research about this, but it should be doable.

Another option, as you suggested, Ktargeter may expose its own set of annotations to be used with other annotations. Or even without exposing anything, we can define a naming convention for annotations that can be used to specify which use-site target to use. For instance, if your Open API annotation has an annotation called @Setter ktargeter can move this annotation to the setter method without having to specify it in ktargeter.annotations. This is just a matter of adding an if statement similar to this one.

from ktargeter.

dzikoysk avatar dzikoysk commented on May 28, 2024

There are a couple of solutions for this. If you have a gradle plugin, you can include the ktargeter plugin as a dependency and pass ktargeter.annotations from the code of your plugin. I am not sure about the details, I would need to research about this, but it should be doable.

That's not an option as it's just annotation processor + runtime library, so I'm not really integrating this with build system. I'd like to just recommend your plugin to my users, so they could use your solution directly and it would work out-of-the-box with set of rules I'd provide with my library :)

Another option, as you suggested, Ktargeter may expose its own set of annotations to be used with other annotations. Or even without exposing anything, we can define a naming convention for annotations that can be used to specify which use-site target to use. For instance, if your Open API annotation has an annotation called @Setter ktargeter can move this annotation to the setter method without having to specify it in ktargeter.annotations. This is just a matter of adding an if statement similar to this one.

We have several annotations with different meaning, so I don't think it makes much sense to try to match some kind of naming convention as it'd be slightly limiting. The perfect solution would be if there would be a standalone annotation I could use on my annotations, I feel like it'd be the most generic approach to this issue and it could be also quite useful for your users in case of their own annotations, so they can manage this functionality at sources level, not build script scope.

from ktargeter.

Shpota avatar Shpota commented on May 28, 2024

Thank you. Let me summarize what you suggest. Ktargeter can have a meta-library exposing annotations like the following: @KtargeterSet, @KtargeterGet, and @KtargeterField. They can be used to annotate other annotations, like the ones you shared. In this case, when Ktargeter is enabled in a Gradle script, it can automatically understand what the proper targets are by inspecting if a particular annotation (OpenAPI annotation in your case) is annotated with one of the ktargeter annotations. Did I sum it up correctly or you meant something else?

from ktargeter.

dzikoysk avatar dzikoysk commented on May 28, 2024

That's exactly what I'd love to see :) I wonder if it wouldn't be better to create just one annotation with array of enum values (SET, GET, FIELD), so there would be a possibility to specify multiple targets at once, because technically that could be an option too.

from ktargeter.

Shpota avatar Shpota commented on May 28, 2024

I would say it is a matter of taste. Personally, I prefer having a single annotation per target. This way it is more concise and easier to understand. At the same time, a user can add two annotations for the case when several targets have to be handled.

from ktargeter.

dzikoysk avatar dzikoysk commented on May 28, 2024

Sure, it was just a suggestion, I'm fine with both approaches :)

from ktargeter.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.