appreciated / demo-helper-view

Component collection to create visually appealing Vaadin addon demos
Apache License 2.0
1 stars 0 forks source link

Customizing JavaCodeReader #10

Open watho opened 5 years ago

watho commented 5 years ago

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 commented 5 years ago

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:

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. 👍