Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizing JavaCodeReader #10

Open
watho opened this issue Mar 11, 2019 · 1 comment
Open

Customizing JavaCodeReader #10

watho opened this issue Mar 11, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@watho
Copy link

watho commented Mar 11, 2019

I really like the idea of JavaCodeReader and using it often in the demo of my last addon. Are there any plans to customize the output? For example, i'd like to strip most but not all Annotations. Sometimes i have a public method which is only there for integration and not to document something which can be removed.

Currently i am using a customized Reader which strips Annotations by a defined list. Stripping by some regular expression should be easy implementable too. I have no real idea how to implement the method stripping. Maybe some external libs like http://javaparser.org/ can be useful. I'd like to contribute my work but wanted to hear your opinion first.

@appreciated
Copy link
Owner

Are there any plans to customize the output?

Currently no, but since this is an open-source project the limits for features are only limited by the time that somebody is willed to put into. I won't be the limiting factor since I like to see my code being used 🙂. And if you want to put in the time you are very welcome to do so!

public method which is only there for integration and not to document something which can be removed.

I'd like to keep the JavaCodeReader as simple as possible, it's purpose is simply to get the code of a Java file as String. Everything else should be done separately. There is already some code in there that actually shouldn't be in there.

Maybe first CodeExample should be able to accept an HasCodeExample Interface which JavaCodeReader and MavenDependencyReader implement to make it easy and unified to wrap these classes with custom implementations.

Currently i am using a customized Reader which strips Annotations by a defined list. Stripping by some regular expression should be easy implementable too. I have no real idea how to implement the method stripping. Maybe some external libs like http://javaparser.org/ can be useful. I'd like to contribute my work but wanted to hear your opinion first.

Before starting with this there should some requirement analysis be done in which we can merge our requirements.

My requirements:

  • Possiblity to read Java Code into a List<String>
  • Possiblity to uncomment outcommented code (f.e. I use this to manipulate @Route Annotations to make the code different on runtime then on "presentation time" since duplicated routes will hinder the application startup) probably I could use only of your mentioned solution for this aswell.

I have no real idea how to implement the method stripping. Maybe some external libs like http://javaparser.org/ can be useful. I'd like to contribute my work but wanted to hear your opinion first.

If you want some advanced code manipulation, probably this is the way to go, you are very welcome to contribute any kind of solution, just keep the basics simple and extensible. 👍

@appreciated appreciated added the enhancement New feature or request label Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants