http://wiki.apidesign.org/index.php?title=LiveDB&feed=atom&action=historyLiveDB - Revision history2024-03-29T15:05:44ZRevision history for this page on the wikiMediaWiki 1.12.0rc1http://wiki.apidesign.org/index.php?title=LiveDB&diff=10204&oldid=prevJaroslavTulach: /* Get the sources */2020-07-22T04:15:28Z<p><span class="autocomment">Get the sources</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 04:15, 22 July 2020</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 30:</td>
<td colspan="2" class="diff-lineno">Line 30:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><source lang="bash"></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><source lang="bash"></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>$ cd samples/livedb</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>$ cd samples/livedb</div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>$ <del style="color: red; font-weight: bold; text-decoration: none;">ant </del>test</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">samples/livedb</ins>$ <ins style="color: red; font-weight: bold; text-decoration: none;">JAVA_HOME=/jdk-11 mvn clean </ins>test</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div></source></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div></source></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=LiveDB&diff=7598&oldid=prevJaroslavTulach: /* Screen Cast */2014-05-18T10:04:50Z<p><span class="autocomment">Screen Cast</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 10:04, 18 May 2014</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 5:</td>
<td colspan="2" class="diff-lineno">Line 5:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>This page documents my experiment showing how to do something similar in good old [[Java]]. Well, it is not old good [[Java]], but [[Java]]6. [[Java]]6 has been around for few years already, but it is common that good ideas take time. As a result we are only slowly recognizing how useful [[AnnotationProcessor]]s can be. </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>This page documents my experiment showing how to do something similar in good old [[Java]]. Well, it is not old good [[Java]], but [[Java]]6. [[Java]]6 has been around for few years already, but it is common that good ideas take time. As a result we are only slowly recognizing how useful [[AnnotationProcessor]]s can be. </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"><!--</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Screen Cast ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Screen Cast ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 12:</td>
<td colspan="2" class="diff-lineno">Line 13:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Thanks [[Geertjan]] for recording this screen cast with me!</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Thanks [[Geertjan]] for recording this screen cast with me!</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">--></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Get the sources ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Get the sources ==</div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=LiveDB&diff=3990&oldid=prevJaroslavTulach: /* Extending IDEs */2010-08-30T05:54:07Z<p><span class="autocomment">Extending IDEs</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 05:54, 30 August 2010</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 61:</td>
<td colspan="2" class="diff-lineno">Line 61:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Extending IDEs ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Extending IDEs ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>The beauty of using [[AnnotationProcessor]]s is in their ability to naturally extend functionality of any IDE (that supports [[AnnotationProcessor]]s). As [[AnnotationProcessor]] [[API]] is part of [[JDK]]6, it is the most standard way to extend any [[Java]] IDE. For example there can be [[AnnotationProcessor]] that supports [[SQL]] syntax inside of the annotation strings.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>The beauty of using [[AnnotationProcessor]]s is in their ability to naturally extend functionality of any IDE (that supports [[AnnotationProcessor]]s). As [[AnnotationProcessor]] [[API]] is part of [[JDK]]6, it is the most standard way to extend any [[Java]] IDE. For example there can be [[AnnotationProcessor]] that supports [[SQL]] syntax inside of the <ins style="color: red; font-weight: bold; text-decoration: none;">[[</ins>annotation<ins style="color: red; font-weight: bold; text-decoration: none;">]]'s </ins>strings.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>[[Image:CompletionStatic.png]]</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>[[Image:CompletionStatic.png]]</div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=LiveDB&diff=3988&oldid=prevJaroslavTulach: ui/* Extending IDEs */2010-08-29T18:48:42Z<p>ui<span class="autocomment">- Extending IDEs</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 18:48, 29 August 2010</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 61:</td>
<td colspan="2" class="diff-lineno">Line 61:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Extending IDEs ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Extending IDEs ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>The beauty of using [[AnnotationProcessor]]s is in their ability to naturally extend functionality of <del style="color: red; font-weight: bold; text-decoration: none;">an </del>IDE. <del style="color: red; font-weight: bold; text-decoration: none;">In some sense </del>[[AnnotationProcessor]] <del style="color: red; font-weight: bold; text-decoration: none;">is a perfect </del>[[API]] to extend any [[Java]] IDE. [[AnnotationProcessor]] <del style="color: red; font-weight: bold; text-decoration: none;">can generate classes, resource files and can also add code completation items into your favorite IDE. As such there could even be code complation on inside of the string representing </del>[[SQL]] <del style="color: red; font-weight: bold; text-decoration: none;">statement to show you list </del>of <del style="color: red; font-weight: bold; text-decoration: none;">all available tables:</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>The beauty of using [[AnnotationProcessor]]s is in their ability to naturally extend functionality of <ins style="color: red; font-weight: bold; text-decoration: none;">any </ins>IDE <ins style="color: red; font-weight: bold; text-decoration: none;">(that supports [[AnnotationProcessor]]s)</ins>. <ins style="color: red; font-weight: bold; text-decoration: none;">As </ins>[[AnnotationProcessor]] [[API]] <ins style="color: red; font-weight: bold; text-decoration: none;">is part of [[JDK]]6, it is the most standard way </ins>to extend any [[Java]] IDE. <ins style="color: red; font-weight: bold; text-decoration: none;">For example there can be </ins>[[AnnotationProcessor]] <ins style="color: red; font-weight: bold; text-decoration: none;">that supports </ins>[[SQL]] <ins style="color: red; font-weight: bold; text-decoration: none;">syntax inside </ins>of <ins style="color: red; font-weight: bold; text-decoration: none;">the annotation strings.</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;"><source lang="sql"></del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">[[Image:CompletionStatic.png]]</ins></div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">select * from <ctrl+space></del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div></div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;"></source></del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">Still you are ''just'' writing a library. You don't need to understand any IDE's [[API]]s. This </del>is all <del style="color: red; font-weight: bold; text-decoration: none;">standard </del>[[<del style="color: red; font-weight: bold; text-decoration: none;">Java</del>]]<del style="color: red; font-weight: bold; text-decoration: none;">6 </del>and <del style="color: red; font-weight: bold; text-decoration: none;">there </del>is <del style="color: red; font-weight: bold; text-decoration: none;">no need for any hacks. </del>[[<del style="color: red; font-weight: bold; text-decoration: none;">AnnotationProcessor</del>]]<del style="color: red; font-weight: bold; text-decoration: none;">s turn [[Java]] into suitable meta-language </del>for <del style="color: red; font-weight: bold; text-decoration: none;">writing </del>[[<del style="color: red; font-weight: bold; text-decoration: none;">DSL</del>]]<del style="color: red; font-weight: bold; text-decoration: none;">s.</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">However providing static syntax </ins>is <ins style="color: red; font-weight: bold; text-decoration: none;">not </ins>all [[<ins style="color: red; font-weight: bold; text-decoration: none;">AnnotationProcessor</ins>]] <ins style="color: red; font-weight: bold; text-decoration: none;">can do. It can generate classes, resource files </ins>and <ins style="color: red; font-weight: bold; text-decoration: none;">can also add dynamic code completion items. It </ins>is <ins style="color: red; font-weight: bold; text-decoration: none;">possible to allow the processor to connect to live </ins>[[<ins style="color: red; font-weight: bold; text-decoration: none;">SQL</ins>]] <ins style="color: red; font-weight: bold; text-decoration: none;">database and show list of existing tables as suggestions </ins>for <ins style="color: red; font-weight: bold; text-decoration: none;">completion inside of the string representing </ins>[[<ins style="color: red; font-weight: bold; text-decoration: none;">SQL</ins>]] <ins style="color: red; font-weight: bold; text-decoration: none;">statement:</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">Indeed, </del>writing <del style="color: red; font-weight: bold; text-decoration: none;">the </del>[[AnnotationProcessor]] <del style="color: red; font-weight: bold; text-decoration: none;">needs </del>a bit of <del style="color: red; font-weight: bold; text-decoration: none;">skills</del>, but it is not that <del style="color: red; font-weight: bold; text-decoration: none;">much </del>complex:</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">[[Image:CompletionDynamic.png]]</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">Still you are ''just'' </ins>writing <ins style="color: red; font-weight: bold; text-decoration: none;">a library. You don't need to understand any IDE's [[API]]s. This is all standard [[Java]]6 and there is no need for any hacks. </ins>[[AnnotationProcessor]]<ins style="color: red; font-weight: bold; text-decoration: none;">s turn [[Java]] into suitable meta-language for writing [[DSL]]s. Here is the code that provides static and dynamic code completion:</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"><source lang="java" snippet="livedb.completions"/></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">The code that generates the data access class follows. Indeed, writing such code requires </ins>a bit of <ins style="color: red; font-weight: bold; text-decoration: none;">understanding of the [[Java]] source model</ins>, but <ins style="color: red; font-weight: bold; text-decoration: none;">overall </ins>it is not that complex:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><source lang="java" snippet="livedb.processor"/></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><source lang="java" snippet="livedb.processor"/></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Just locate all packages annotated by ''@LiveDB'', <del style="color: red; font-weight: bold; text-decoration: none;">reads </del>the annotation data and use them to generate new [[Java]] source file. The file <del style="color: red; font-weight: bold; text-decoration: none;">which </del>later be compiled by the [[JavaC]] compiler.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Just locate all packages annotated by ''@LiveDB'', <ins style="color: red; font-weight: bold; text-decoration: none;">read </ins>the annotation data and use them to generate new [[Java]] source file. The <ins style="color: red; font-weight: bold; text-decoration: none;">generated </ins>file <ins style="color: red; font-weight: bold; text-decoration: none;">willl </ins>later be compiled by the [[JavaC]] compiler.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Philosohical Aspects ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Philosohical Aspects ==</div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=LiveDB&diff=3913&oldid=prevJaroslavTulach: /* Philosohical Aspects */2010-08-02T21:21:53Z<p><span class="autocomment">Philosohical Aspects</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 21:21, 2 August 2010</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 80:</td>
<td colspan="2" class="diff-lineno">Line 80:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><comments/></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><comments/></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">[[Category:Video]] [[Category:APIDesignPatterns:Encapsulation]] [[Category:APIDesignPatterns]]</ins></div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=LiveDB&diff=3912&oldid=prevJaroslavTulach: /* Get the sources */2010-08-02T20:51:16Z<p><span class="autocomment">Get the sources</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 20:51, 2 August 2010</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 18:</td>
<td colspan="2" class="diff-lineno">Line 18:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><source lang="bash"></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><source lang="bash"></div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>$ hg clone <del style="color: red; font-weight: bold; text-decoration: none;">-r livedb </del>http://source.apidesign.org/hg/apidesign/</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>$ hg clone http://source.apidesign.org/hg/apidesign/</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>$ cd apidesign</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>$ cd apidesign</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>$ hg pull</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>$ hg pull</div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=LiveDB&diff=3909&oldid=prevJaroslavTulach: /* Extending IDEs */2010-07-30T17:09:07Z<p><span class="autocomment">Extending IDEs</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 17:09, 30 July 2010</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 61:</td>
<td colspan="2" class="diff-lineno">Line 61:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Extending IDEs ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Extending IDEs ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>The beauty of using [[AnnotationProcessor]]s is in their ability to naturally extend functionality of an IDE. In some sense [[AnnotationProcessor]] is a perfect [[API]] to extend any [[Java]] IDE.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>The beauty of using [[AnnotationProcessor]]s is in their ability to naturally extend functionality of an IDE. In some sense [[AnnotationProcessor]] is a perfect [[API]] to extend any [[Java]] IDE. <ins style="color: red; font-weight: bold; text-decoration: none;">[[AnnotationProcessor]] can generate classes, resource files and can also add code completation items into your favorite IDE. As such there could even be code complation on inside of the string representing [[SQL]] statement to show you list of all available tables:</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"><source lang="sql"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">select * from <ctrl+space></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"></source></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Still you are ''just'' writing a library. You don't need to understand any IDE's [[API]]s. This is all standard [[Java]]6 and there is no need for any hacks. [[AnnotationProcessor]]s turn [[Java]] into suitable meta-language for writing [[DSL]]s.</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Still you are ''just'' writing a library. You don't need to understand any IDE's [[API]]s. This is all standard [[Java]]6 and there is no need for any hacks. [[AnnotationProcessor]]s turn [[Java]] into suitable meta-language for writing [[DSL]]s.</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 69:</td>
<td colspan="2" class="diff-lineno">Line 73:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><source lang="java" snippet="livedb.processor"/></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><source lang="java" snippet="livedb.processor"/></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">Most of the code is [[JDBC]] specific, the rest just locates </del>all packages annotated by ''@LiveDB'', reads <del style="color: red; font-weight: bold; text-decoration: none;">their </del>data and <del style="color: red; font-weight: bold; text-decoration: none;">uses </del>them to generate new [[Java]] source file<del style="color: red; font-weight: bold; text-decoration: none;">, </del>which <del style="color: red; font-weight: bold; text-decoration: none;">will </del>be compiled <del style="color: red; font-weight: bold; text-decoration: none;">later </del>by the [[JavaC]] compiler.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">Just locate </ins>all packages annotated by ''@LiveDB'', reads <ins style="color: red; font-weight: bold; text-decoration: none;">the annotation </ins>data and <ins style="color: red; font-weight: bold; text-decoration: none;">use </ins>them to generate new [[Java]] source file<ins style="color: red; font-weight: bold; text-decoration: none;">. The file </ins>which <ins style="color: red; font-weight: bold; text-decoration: none;">later </ins>be compiled by the [[JavaC]] compiler<ins style="color: red; font-weight: bold; text-decoration: none;">.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">== Philosohical Aspects ==</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">In some sense with an annotation like ''@LiveDB'' the structure of your database becomes part of your sources. But that is good, is not it? I really hate when a truth is spelled out at two different places (e.g. in [[Hibernate]] entity classes and also in the database schema). With [[LiveDB]] you just need a lightweight compile time database (like [[Derby]]) with the same structure as your deployment database being ready. The schema of such database is your definition of truth which remains at a single place</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><comments/></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><comments/></div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=LiveDB&diff=3907&oldid=prevJaroslavTulach: /* Screen Cast */2010-07-30T12:42:47Z<p><span class="autocomment">Screen Cast</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 12:42, 30 July 2010</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 7:</td>
<td colspan="2" class="diff-lineno">Line 7:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Screen Cast ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Screen Cast ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>As <del style="color: red; font-weight: bold; text-decoration: none;">pictures speak </del>thousands of words, you can now watch a screencast recorded to demonstrate the functionality of this project. Simply press play!</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>As <ins style="color: red; font-weight: bold; text-decoration: none;">picture easily expresses more than </ins>thousands of words <ins style="color: red; font-weight: bold; text-decoration: none;">ever could</ins>, you can now watch a screencast recorded to demonstrate the functionality of this project. Simply press play!</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>{{#ev:bliptv|3952631|600}}</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>{{#ev:bliptv|3952631|600}}</div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=LiveDB&diff=3906&oldid=prev77.249.170.237: /* Screen Cast */2010-07-29T18:59:23Z<p><span class="autocomment">Screen Cast</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 18:59, 29 July 2010</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 7:</td>
<td colspan="2" class="diff-lineno">Line 7:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Screen Cast ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Screen Cast ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>As <del style="color: red; font-weight: bold; text-decoration: none;">visual impression is usually much stronger than </del>thousands of words, you can now watch a <del style="color: red; font-weight: bold; text-decoration: none;">screen cast </del>recorded to demonstrate the functionality of this project. <del style="color: red; font-weight: bold; text-decoration: none;">Just </del>press play!</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>As <ins style="color: red; font-weight: bold; text-decoration: none;">pictures speak </ins>thousands of words, you can now watch a <ins style="color: red; font-weight: bold; text-decoration: none;">screencast </ins>recorded to demonstrate the functionality of this project. <ins style="color: red; font-weight: bold; text-decoration: none;">Simply </ins>press play!</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>{{#ev:bliptv|3952631|600}}</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>{{#ev:bliptv|3952631|600}}</div></td></tr>
</table>77.249.170.237http://wiki.apidesign.org/index.php?title=LiveDB&diff=3905&oldid=prevJaroslavTulach at 16:05, 29 July 20102010-07-29T16:05:32Z<p></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 16:05, 29 July 2010</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 37:</td>
<td colspan="2" class="diff-lineno">Line 37:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>The first thing you need to do to really play with the sample is to create your own database. Maybe you have one, maybe you need to create one. If you have [[NetBeans]] IDE then one is ready for you. Just start the [[Derby]] database as explained for example at [http://netbeans.org/kb/docs/ide/java-db.html JavaDB tutorial]. Create a table called AGE with two columns NAME and AGE.</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>The first thing you need to do to really play with the sample is to create your own database. Maybe you have one, maybe you need to create one. If you have [[NetBeans]] IDE then one is ready for you. Just start the [[Derby]] database as explained for example at [http://netbeans.org/kb/docs/ide/java-db.html JavaDB tutorial]. Create a table called AGE with two columns NAME and AGE.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">== Use Code Completion ==</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">Now you need to define a connection to your database. Do it by using the ''@LiveDB'' annotation:</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">Now open the ''samples/</del>livedb<del style="color: red; font-weight: bold; text-decoration: none;">'' project in [[NetBeans]] IDE 6</del>.<del style="color: red; font-weight: bold; text-decoration: none;">9. Version 6.9 is the necessary minimum, as it is the first version that provides superior support for [[AnnotationProcessor]]s</del>.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"><source lang="java" snippet="</ins>livedb.<ins style="color: red; font-weight: bold; text-decoration: none;">connection</ins>.<ins style="color: red; font-weight: bold; text-decoration: none;">annotation"/></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">Open for example </del>'''<del style="color: red; font-weight: bold; text-decoration: none;">LiveDBTest.java</del>'''. <del style="color: red; font-weight: bold; text-decoration: none;">It uses </del>class <del style="color: red; font-weight: bold; text-decoration: none;">'</del>''Age''<del style="color: red; font-weight: bold; text-decoration: none;">'. That </del>class <del style="color: red; font-weight: bold; text-decoration: none;">is dynamically generated during compile time </del>to <del style="color: red; font-weight: bold; text-decoration: none;">reflect structure of </del>the <del style="color: red; font-weight: bold; text-decoration: none;">AGE table created before</del>. <del style="color: red; font-weight: bold; text-decoration: none;">But try </del>for example code completion on:</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">As you can see this is compile time annotation, as such it needs to be processed by [[AnnotationProcessor]]. Indeed there is one in this project too, but rather than dicovering the magic, let</ins>'<ins style="color: red; font-weight: bold; text-decoration: none;">s explore the ease of use: To access a database, just use the above given annotation on some package statement:</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"><source lang="java" snippet="livedb.connect"/></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">Of course you need to fill in proper connection credentials, and also the name of a class (</ins>''<ins style="color: red; font-weight: bold; text-decoration: none;">Age</ins>'<ins style="color: red; font-weight: bold; text-decoration: none;">' in the above case) that you wish to use to represent result of your ''query</ins>''. <ins style="color: red; font-weight: bold; text-decoration: none;">Done? If so, you are ready to use the </ins>class <ins style="color: red; font-weight: bold; text-decoration: none;">(which almost magically appears in your package). For example, in the following code snipptet, you can refer to the </ins>''Age<ins style="color: red; font-weight: bold; text-decoration: none;">.query</ins>'' <ins style="color: red; font-weight: bold; text-decoration: none;">method and also access the fields of the </ins>class<ins style="color: red; font-weight: bold; text-decoration: none;">:</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"><source lang="java" snippet="livedb.test"/></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">If you done things correctly, you have working access </ins>to <ins style="color: red; font-weight: bold; text-decoration: none;">live database. Everything compiles, runs and last, but not least, your IDE (if it is any good, like [[NetBeans]] IDE 6.9), will properly understood and use </ins>the <ins style="color: red; font-weight: bold; text-decoration: none;">on-the-fly generated ''Age'' class</ins>. <ins style="color: red; font-weight: bold; text-decoration: none;">Try </ins>for example code completion on:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><source lang="java"></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><source lang="java"></div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 47:</td>
<td colspan="2" class="diff-lineno">Line 55:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div></source></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div></source></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>You will correctly see fields representing individual rows in the t able. Moreover these fields have proper types (e.g. NAME is String, AGE is BigInteger). All of this is <del style="color: red; font-weight: bold; text-decoration: none;">a result </del>of <del style="color: red; font-weight: bold; text-decoration: none;">simple use of the ''@LiveDB'' annotation in the ''package-info.java'' file:</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>You will correctly see fields representing individual rows in the t able. Moreover these fields have proper types (e.g. NAME is String, AGE is BigInteger). <ins style="color: red; font-weight: bold; text-decoration: none;">Feels like ''Java on Rails''? </ins>All of this is <ins style="color: red; font-weight: bold; text-decoration: none;">brought to you by the power </ins>of <ins style="color: red; font-weight: bold; text-decoration: none;">[[AnnotationProcessor]]s!</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;"><source lang="java"></del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">You can also modify the table structure by adding new column. As soon as you do it </ins>(<ins style="color: red; font-weight: bold; text-decoration: none;">and tell the IDE to refresh)</ins>, <ins style="color: red; font-weight: bold; text-decoration: none;">you can immediatelly use the new fields in your code</ins>. <ins style="color: red; font-weight: bold; text-decoration: none;">Everything compiles</ins>. <ins style="color: red; font-weight: bold; text-decoration: none;">Btw</ins>. <ins style="color: red; font-weight: bold; text-decoration: none;">you need to tell the [[NetBeans]] IDE to refresh. You can either use new action ''Refresh All Metadata'' for that or you can step into ''package-info.java'', add an empty line and save the file</ins>. </div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">@LiveDB</del>(</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div></div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;"> classname="Age"</del>, <del style="color: red; font-weight: bold; text-decoration: none;">password="j1", user="j1",</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div></div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;"> query="select * from APP</del>.<del style="color: red; font-weight: bold; text-decoration: none;">AGE", </del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div></div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;"> url="jdbc:derby://localhost:1527/livedb"</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div></div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">)</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div></div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">package org</del>.<del style="color: red; font-weight: bold; text-decoration: none;">apidesign</del>.<del style="color: red; font-weight: bold; text-decoration: none;">livedb</del>.<del style="color: red; font-weight: bold; text-decoration: none;">example;</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">import org</del>.<del style="color: red; font-weight: bold; text-decoration: none;">apidesign</del>.<del style="color: red; font-weight: bold; text-decoration: none;">livedb</del>.<del style="color: red; font-weight: bold; text-decoration: none;">LiveDB;</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">== Extending IDEs ==</ins></div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;"></source></del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">The beauty of using [[AnnotationProcessor]]s is in their ability to naturally extend functionality of an IDE</ins>. <ins style="color: red; font-weight: bold; text-decoration: none;">In some sense [[AnnotationProcessor]] is a perfect [[API]] to extend any [[Java]] IDE</ins>.</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">Still you are ''just'' writing a library</ins>. <ins style="color: red; font-weight: bold; text-decoration: none;">You don't need to understand any IDE's [[API]]s. This is all standard [[Java]]6 and there is no need for any hacks. [[AnnotationProcessor]]s turn [[Java]] into suitable meta-language for writing [[DSL]]s.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">Indeed, writing the [[AnnotationProcessor]] needs a bit of skills, but it is not that much complex:</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>== <del style="color: red; font-weight: bold; text-decoration: none;">Modify the Table ==</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"><source lang</ins>=<ins style="color: red; font-weight: bold; text-decoration: none;">"java" snippet</ins>=<ins style="color: red; font-weight: bold; text-decoration: none;">"livedb.processor"/></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">Now add new column to the table. Use it in </del>the code<del style="color: red; font-weight: bold; text-decoration: none;">. See if code completion sees it (probably not). If everything compiles (probably yes)</del>.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">Most of </ins>the code <ins style="color: red; font-weight: bold; text-decoration: none;">is [[JDBC]] specific, the rest just locates all packages annotated by ''@LiveDB'', reads their data and uses them to generate new [[Java]] source file, which will be compiled later by the [[JavaC]] compiler</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">tbd.</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;"><comments/></ins></div></td></tr>
</table>JaroslavTulach