racker/java-service-registry-client — pull request #4 by gdusbabek (2012-11-13 18:50:34+00:00)
Title: Automate the process of generating code examples for this project.

Context:
```
gdusbabek> I'm also fleshing out the readme so people know how ot use it.
Kami_> or lets spend 5 more minutes at the beginning to add Makefile target or smth which inlines the examples ￼
gdusbabek> 5 minutes my ass.
```
It turns out that a fair amount of plumbing was required.

At some point, this code should be in its own place. We can do that when someone else wants to use it.

Prelimary: only tested on sun jvm (requires tools.jar)

* Introduces @Example annotation. Annotate all the examples you wish to preserve with a unique tag.
* The annotations are the same everywhere (in java and in the source text that gets replaced).
* See src/main/resources/README.md and src/main/java/..../examples/Readme.java for an example.
* CodeExtractor.java captures a map of tags->source
* TagReplacer applies a CodeExtractor to a map of source->destination files.
* source files have their tags replaced with methods, and are rewritten as dest files.
* Generator wraps everything up into a main method.
* There are some tests (only run with ant).
* Modified pom to use tools.jar.

src/main/resources/generate.properties is the map from source files to destination files. Only these files get processed and written.

Currently the only source file is in src/main/resources/README.md (is used to generate README.md). There will be more.

I couldn't figure out how to easily do this using Maven, so I wrote an ant build to do it. Ant targets are:

clean - cleans up.
compile - runs javac
test - runs the tests
run - performs the replacements!!!