<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>AnnoJ development</title>
	<atom:link href="http://annojdev.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://annojdev.wordpress.com</link>
	<description>About the development of AnnoJ, a small Java annotation library for developers.</description>
	<lastBuildDate>Thu, 15 Oct 2009 08:00:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='annojdev.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>AnnoJ development</title>
		<link>http://annojdev.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://annojdev.wordpress.com/osd.xml" title="AnnoJ development" />
	<atom:link rel='hub' href='http://annojdev.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Alternative ways of toString() generation with AnnoJ</title>
		<link>http://annojdev.wordpress.com/2009/10/15/alternative-ways-tostring-generation-with-annoj/</link>
		<comments>http://annojdev.wordpress.com/2009/10/15/alternative-ways-tostring-generation-with-annoj/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 08:00:58 +0000</pubDate>
		<dc:creator>akostajti</dc:creator>
				<category><![CDATA[example]]></category>
		<category><![CDATA[how it works]]></category>
		<category><![CDATA[introduction]]></category>
		<category><![CDATA[@ToString]]></category>
		<category><![CDATA[annoj]]></category>
		<category><![CDATA[classloading]]></category>

		<guid isPermaLink="false">http://annojdev.wordpress.com/?p=45</guid>
		<description><![CDATA[In  the post &#8220;Using the @ToString annotation&#8221; you saw how easy it is to use @ToString. In this post I&#8217;ll show you how you can generate toString() methods in classes without using MainMethodBootstrap.  The annoj.annotation.transformers package contains classes that are responsible for transforming class bytecode. Currently there&#8217;s one for toString() generation and onew for logging. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=45&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">In  the post &#8220;<a title="Using the @ToString annotation" href="http://annojdev.wordpress.com/2009/10/14/using-the-tostring-annotation/" target="_blank">Using the @ToString annotation</a>&#8221; you saw how easy it is to use <code>@ToString</code>. In this post I&#8217;ll show you how you can generate <code>toString()</code> methods in classes without using <a title="MainMethodBootstrap" href="http://delfin.unideb.hu/~ta0725/doc/annoj/loader/MainMethodBootstrap.html" target="_blank"><code>MainMethodBootstrap</code></a>. </p>
<p style="text-align:justify;">The <a title="annoj.annotation.transformers" href="http://delfin.unideb.hu/~ta0725/doc/annoj/transformers/package-summary.html" target="_blank"><code>annoj.annotation.transformers</code></a> package contains classes that are responsible for transforming class bytecode. Currently there&#8217;s one for <code>toString()</code> generation and onew for logging. In order to be able to instrument classes you have to instantiate <a title="TransformingClassLoader" href="http://delfin.unideb.hu/~ta0725/doc/annoj/loader/TransformingClassLoader.html" target="_blank"><code>TransformingClassLoader</code></a> with a list of <a title="ClassTransformer" href="http://delfin.unideb.hu/~ta0725/doc/annoj/transformers/ClassTransformer.html" target="_blank"><code>ClassTransformer</code></a> objects and use that instance for loading the classes you want to modify. For example:</p>
<p><pre class="brush: java;">
     List tl = Collections.singletonList(new ToStringCreator());
     TransformingClassLoader loader = new TransformingClassLoader(tl);
     loader.loadClass(&quot;Person&quot;);
</pre></p>
<p style="text-align:justify;">This classloader modifies the classes if it finds the appropriate annotations. It&#8217;s important that <strong>the classloader should only be used in a so called bootstrap class which loads this classloader and then loads the classes with it</strong>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/annojdev.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/annojdev.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/annojdev.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/annojdev.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/annojdev.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/annojdev.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/annojdev.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/annojdev.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/annojdev.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/annojdev.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/annojdev.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/annojdev.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/annojdev.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/annojdev.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=45&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://annojdev.wordpress.com/2009/10/15/alternative-ways-tostring-generation-with-annoj/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4221ea1a8282ecd64aa42db1dc7c8ec9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akostajti</media:title>
		</media:content>
	</item>
		<item>
		<title>How does AnnoJ work?</title>
		<link>http://annojdev.wordpress.com/2009/10/14/how-does-annoj-work/</link>
		<comments>http://annojdev.wordpress.com/2009/10/14/how-does-annoj-work/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 13:54:12 +0000</pubDate>
		<dc:creator>akostajti</dc:creator>
				<category><![CDATA[how it works]]></category>
		<category><![CDATA[introduction]]></category>
		<category><![CDATA[annoj]]></category>

		<guid isPermaLink="false">http://annojdev.wordpress.com/?p=28</guid>
		<description><![CDATA[As you might guess AnnoJ modifies the bytecode of your classes. When TransformingClassLoader (the custom classloader used by AnnoJ) is asked to load a class it checks if its methods/fields or the entire class is annotated with @Loggable, @ToString or @Exclude. After that it tries to transform the bytecode of the class according to the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=28&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">As you might guess <strong>AnnoJ modifies the bytecode of your classes</strong>. When <a title="TransformingClassLoader" href="http://delfin.unideb.hu/~ta0725/doc/annoj/loader/TransformingClassLoader.html" target="_blank"><code>TransformingClassLoader</code></a> (the custom classloader used by AnnoJ) is asked to load a class it checks if its methods/fields or the entire class is annotated with <a title="Usinng the Loggable" href="http://annojdev.wordpress.com/2009/10/14/using-the-loggable-annotation/" target="_blank"><code>@Loggable</code></a>, <a title="Using the @ToString annotation" href="http://annojdev.wordpress.com/2009/10/14/using-the-tostring-annotation/" target="_blank"><code>@ToString</code></a> or <code>@Exclude</code>. After that it tries to transform the bytecode of the class according to the annotations. If you use <a title="MainMethodBootstrap" href="http://delfin.unideb.hu/~ta0725/doc/annoj/loader/MainMethodBootstrap.html" target="_blank"><code>MainMethodBootstrap</code></a> to start your application all classes are loaded with <code>TransformingClassLoader</code>.</p>
<p style="text-align:justify;">AnnoJ uses <a title="javassist" href="http://www.csg.is.titech.ac.jp/~chiba/javassist/" target="_blank">javassist</a> for bytecode modification. With this library it&#8217;s fairly easy to accomplish the neccessary transformations. For example the code below adds a logging method call to the beggining of the methods of a class called <code>className</code>:</p>
<pre style="text-align:justify;"><pre class="brush: java;">
     ClassPool pool = ClassPool.getDefault();
     CtClass ct = pool.get(className);
     CtMethod[] methods = ct.getDeclaredMethods();

     for (CtMethod method : methods) {
          method.insertBefore(&amp;quot;{System.out.println(\&amp;quot;invoked: &amp;quot; + method.getName() + &amp;quot;(\&amp;quot; +  java.util.Arrays.asList($args) +\&amp;quot;)\&amp;quot;);}&amp;quot;);
     }

     ct.toClass();
</pre></p>
<p style="text-align:justify;">As you can see you don't have to bother yourself with the byecode - it can be modified at Java level. For more information consult the <a title="javassist tutorial" href="http://www.csg.is.titech.ac.jp/~chiba/javassist/tutorial/tutorial.html" target="_blank">javassist documentation</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/annojdev.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/annojdev.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/annojdev.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/annojdev.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/annojdev.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/annojdev.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/annojdev.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/annojdev.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/annojdev.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/annojdev.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/annojdev.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/annojdev.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/annojdev.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/annojdev.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=28&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://annojdev.wordpress.com/2009/10/14/how-does-annoj-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4221ea1a8282ecd64aa42db1dc7c8ec9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akostajti</media:title>
		</media:content>
	</item>
		<item>
		<title>Why is AnnoJ useful?</title>
		<link>http://annojdev.wordpress.com/2009/10/14/why-is-annoj-useful/</link>
		<comments>http://annojdev.wordpress.com/2009/10/14/why-is-annoj-useful/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 13:37:14 +0000</pubDate>
		<dc:creator>akostajti</dc:creator>
				<category><![CDATA[introduction]]></category>
		<category><![CDATA[annoj]]></category>

		<guid isPermaLink="false">http://annojdev.wordpress.com/?p=26</guid>
		<description><![CDATA[Consider an application full of generated classes (by wsimport, for example). When many methods accepts this generated types as parameters logging/debugging is mere pain. If a method is called and you need to see the internal state of the paraeter object you have to work hard &#8211; unless you have an efficient tool for the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=26&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Consider an application full of generated classes (by <a title="wsimport" href="http://java.sun.com/javase/6/docs/technotes/tools/share/wsimport.html" target="_blank">wsimport</a>, for example). When many methods accepts this generated types as parameters logging/debugging is mere pain. I<strong>f a method is called and you need to see the internal state of the paraeter object you have to work hard</strong> &#8211; unless you have an efficient tool for the job.</p>
<p style="text-align:justify;">With <code>@ToString</code> annotation AnnoJ is able to generate <code>toString()</code> methods so you only have to print the parameters the object will show you its internal state.</p>
<p style="text-align:justify;">Or think about <strong>logging</strong>. Sometimes it&#8217;s important to log when a method is called. How does AnnoJ help you? By using <strong>@Loggable</strong> annotation it can implement this kind (and many other kinds in the future) of logging.</p>
<p style="text-align:justify;">.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/annojdev.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/annojdev.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/annojdev.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/annojdev.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/annojdev.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/annojdev.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/annojdev.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/annojdev.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/annojdev.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/annojdev.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/annojdev.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/annojdev.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/annojdev.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/annojdev.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=26&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://annojdev.wordpress.com/2009/10/14/why-is-annoj-useful/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4221ea1a8282ecd64aa42db1dc7c8ec9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akostajti</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the @Loggable annotation</title>
		<link>http://annojdev.wordpress.com/2009/10/14/using-the-loggable-annotation/</link>
		<comments>http://annojdev.wordpress.com/2009/10/14/using-the-loggable-annotation/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 12:50:24 +0000</pubDate>
		<dc:creator>akostajti</dc:creator>
				<category><![CDATA[example]]></category>
		<category><![CDATA[introduction]]></category>
		<category><![CDATA[@Loggable]]></category>
		<category><![CDATA[annoj]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://annojdev.wordpress.com/?p=19</guid>
		<description><![CDATA[With @Loggable you can tell AnnoJ to generate logging method calls at the beggining of some methods. For example if you have the following class definition AnnoJ will modify importantMethod() to look like this: That is you can log when a method gets called without manually writing the logging code. What&#8217;s better AnnoJ will log [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=19&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">With <code>@Loggable</code> you can tell AnnoJ to <strong>generate logging method calls at the beggining of some methods</strong>. For example if you have the following class definition</p>
<p><pre class="brush: java;">
@Loggable
public class InterestingClass{
     public void importantMethod(){
          //some code here
     }
}
</pre></p>
<p style="text-align:justify;">AnnoJ will modify <code>importantMethod()</code> to look like this:</p>
<p><pre class="brush: java;">
importantMethod(){
     log(&quot;importantMethod called&quot;);
     //some code here
}
</pre></p>
<p style="text-align:justify;">That is you can log when a method gets called without manually writing the logging code. What&#8217;s better AnnoJ will log the actual parameter values. Combined with the <a title="Using the @ToString annotation" href="http://annojdev.wordpress.com/2009/10/14/using-the-tostring-annotation/" target="_blank"><code>@ToString</code></a> annotation this can be a powerful tool.</p>
<p style="text-align:justify;">As with <code>@ToString</code> if you place <code>@Loggable</code> before a class definition then all methods will be logged. If you want t<strong>o exclude some methods </strong>use the <code>@Exclude</code> annotation (just put it before the method you want to leave out). Alternatively you can specify in a <code>String</code> array which methods to include:</p>
<p><pre class="brush: java;">
@Loggable(methods={&quot;importantMethod&quot;})
public class InterestingClass{
     public void importantMethod(){
          //other methods
     }
}
</pre></p>
<p style="text-align:justify;">In this case only<code> importantMethod()</code> will be logged.</p>
<p style="text-align:justify;">If you want that <strong>all methods of all classes of a package be logged</strong> just define a public class called <code>PackageInfo</code> and annotate it with <code>@Loggable</code> (you cant use parameters here).</p>
<p style="text-align:justify;">The <code>@Loggable</code> annotation uses <a title="log4j" href="http://logging.apache.org/log4j/1.2/index.html" target="_blank">Log4j</a> so y<strong>ou must provide a properly configured log4j.properties file in the root of your application</strong>.</p>
<p style="text-align:justify;">As with the other annotations to use <code>@Loggable</code> <strong>you must <a title="Introdusing AnnoJ" href="http://annojdev.wordpress.com/2009/10/14/introducing-annoj/" target="_blank">bootstrap</a></strong> your application.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/annojdev.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/annojdev.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/annojdev.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/annojdev.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/annojdev.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/annojdev.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/annojdev.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/annojdev.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/annojdev.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/annojdev.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/annojdev.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/annojdev.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/annojdev.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/annojdev.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=19&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://annojdev.wordpress.com/2009/10/14/using-the-loggable-annotation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4221ea1a8282ecd64aa42db1dc7c8ec9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akostajti</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the @ToString annotation</title>
		<link>http://annojdev.wordpress.com/2009/10/14/using-the-tostring-annotation/</link>
		<comments>http://annojdev.wordpress.com/2009/10/14/using-the-tostring-annotation/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 12:26:46 +0000</pubDate>
		<dc:creator>akostajti</dc:creator>
				<category><![CDATA[example]]></category>
		<category><![CDATA[introduction]]></category>
		<category><![CDATA[@ToString]]></category>
		<category><![CDATA[annoj]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://annojdev.wordpress.com/?p=12</guid>
		<description><![CDATA[One of the annotation types of AnnoJ is @ToString. With @ToString you can leave the implementation of the toString() methods to AnnoJ. After bootstrapping your application you can use toString() as if you implemented it manually. To generate the toString() method in a class simply put the @ToString annotation just before the class definition: After [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=12&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">One of the annotation types of AnnoJ is <code>@ToString</code>. With <code>@ToString</code> you can leave the implementation of the <code>toString()</code> methods to AnnoJ. After <a title="how to use AnnoJ" href="http://annojdev.wordpress.com/2009/10/14/how-to-use-annoj/" target="_blank">bootstrapping</a> your application you can use <code>toString()</code> as if you implemented it manually.</p>
<p style="text-align:justify;">To generate the <code>toString()</code> method in a class <strong>simply put the <code>@ToString</code> annotation just before the class definition</strong>:</p>
<p><pre class="brush: java;">

@ToString
	public class InterestingClass{
		private Integer x;
                private String s;
                // more code
	}

</pre></p>
<p style="text-align:justify;">After bootstrapping the application AnnoJ will generate a <code>toString()</code> method similar to this:</p>
<p><pre class="brush: java;">

public String toString(){

return &quot;[&quot; + (this.x==null?&quot;&quot;:&quot;x=&quot;+this.x) + &quot;,&quot; + (this.s==null?&quot;&quot;:&quot;s=&quot;+this.s) + &quot;]&quot;;

}

</pre></p>
<p style="text-align:justify;">If you want to <strong>leave <code>x</code> from the method</strong> just place the <code>@Exclude</code> annotation before the field:</p>
<p><pre class="brush: java;">

@ToString
	public class InterestingClass{
                @Exclude
		private Integer x;
                private String s;
                // more code
	}

</pre></p>
<p style="text-align:justify;">To <strong>generate a <code>toString()</code> method in all classes of a package</strong> you should define a public class named <code>PackageInfo</code> and annotate it with <code>@ToString</code>:</p>
<p><pre class="brush: java;">

@ToString public class PackageInfo{}

</pre></p>
<p style="text-align:justify;">In the future versions of AnnoJ there will be an option to leave out from <code>toString()</code> generation all fields with a given visiblity and you will be able to use the <code>@Include</code> annotation together with <code>@ToString</code>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/annojdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/annojdev.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/annojdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/annojdev.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/annojdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/annojdev.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/annojdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/annojdev.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/annojdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/annojdev.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/annojdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/annojdev.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/annojdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/annojdev.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=12&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://annojdev.wordpress.com/2009/10/14/using-the-tostring-annotation/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4221ea1a8282ecd64aa42db1dc7c8ec9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akostajti</media:title>
		</media:content>
	</item>
		<item>
		<title>How to use AnnoJ?</title>
		<link>http://annojdev.wordpress.com/2009/10/14/how-to-use-annoj/</link>
		<comments>http://annojdev.wordpress.com/2009/10/14/how-to-use-annoj/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 12:08:57 +0000</pubDate>
		<dc:creator>akostajti</dc:creator>
				<category><![CDATA[example]]></category>
		<category><![CDATA[introduction]]></category>
		<category><![CDATA[annoj]]></category>
		<category><![CDATA[classloading]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://annojdev.wordpress.com/?p=9</guid>
		<description><![CDATA[As I mentioned in the previous post in AnnoJ everything&#8217;s implemented with annotations. More precisely: with runtime annotations. This means that you can place annotations on your packages (I will explain how), classes, methods and fields and these are evaluated at runtime. In the current version of AnnoJ the problem of runtime annotation evaluation is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=9&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">As I mentioned in the <a title="Introducing AnnoJ" href="http://annojdev.wordpress.com/2009/10/14/introducing-annoj/" target="_blank">previous post</a> in AnnoJ <strong>everything&#8217;s implemented with <a title="Java Annotations" href="http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html" target="_blank">annotations</a></strong>. More precisely: with runtime annotations. This means that you can place annotations on your packages (I will explain how), classes, methods and fields and these are evaluated at runtime. In the current version of AnnoJ the problem of runtime annotation evaluation is solved with the use of a custom <a title="classloader" href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ClassLoader.html" target="_blank">classloader</a>. <strong>You must load all your annotated classes with this classloader</strong>. To make this task easy AnnoJ defines the <a title="MainMethodBootstrap class" href="http://delfin.unideb.hu/~ta0725/doc/annoj/loader/MainMethodBootstrap.html" target="_blank"><code>MainMethodBootstrap</code></a> class. This class is responsible for the corrent processing of the annotations. The only thing you have to do is to tell it the name of the main class of your application and the command-line arguments you want to pass. An example:</p>
<p><pre class="brush: java;"> public class StarterClass{

		public static void main(String[] args){
			MainMethodBootstrap.callMainMethod(&quot;ClassWithMainMethod&quot;,
						 new String[]{&quot;something&quot;});
		}
	}

</pre></p>
<p style="text-align:justify;">Here <code>ClassWithMainMethod</code> is the main class (ie. contains a <code>public static void main(String[])</code> method).The command-line arguments to be passed to the main method are listed in the second argument of the <code>callMainMethod()</code> method. And that&#8217;s all!</p>
<p style="text-align:justify;">One important thing is that because of the custom classloader at the moment AnnoJ can&#8217;t be used in application servers. Hopefully this will change in the future versions.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/annojdev.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/annojdev.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/annojdev.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/annojdev.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/annojdev.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/annojdev.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/annojdev.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/annojdev.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/annojdev.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/annojdev.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/annojdev.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/annojdev.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/annojdev.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/annojdev.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=9&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://annojdev.wordpress.com/2009/10/14/how-to-use-annoj/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4221ea1a8282ecd64aa42db1dc7c8ec9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akostajti</media:title>
		</media:content>
	</item>
		<item>
		<title>Introducing AnnoJ</title>
		<link>http://annojdev.wordpress.com/2009/10/14/introducing-annoj/</link>
		<comments>http://annojdev.wordpress.com/2009/10/14/introducing-annoj/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 11:45:13 +0000</pubDate>
		<dc:creator>akostajti</dc:creator>
				<category><![CDATA[introduction]]></category>
		<category><![CDATA[annoj]]></category>

		<guid isPermaLink="false">http://annojdev.wordpress.com/?p=4</guid>
		<description><![CDATA[AnnoJ is a small library containing tools for developers. With Annoj you can avoid writing boilerplate code in some cases. The current version of AnnoJ has to features: automated generation of logging code automated generation of toString() methods As you can see, both features facilitate logging. In AnnoJ everything is implemented with annotations. You can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=4&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">AnnoJ is a small library containing tools for developers. With Annoj you can avoid writing boilerplate code in some cases. The current version of AnnoJ has to features:</p>
<ul style="text-align:justify;">
<li>automated generation of logging code</li>
<li>automated generation of <code>toString()</code> methods</li>
</ul>
<p style="text-align:justify;">As you can see, both features facilitate logging.</p>
<p style="text-align:justify;">In AnnoJ everything is implemented with annotations. You can download the library from the <a title="sourceforge project page" href="https://sourceforge.net/projects/annoj/" target="_blank">sourceforge project page</a>. To read the API documentation visit <a title="annoj api documentation" href="http://delfin.unideb.hu/~ta0725/doc/" target="_blank">this link</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/annojdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/annojdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/annojdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/annojdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/annojdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/annojdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/annojdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/annojdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/annojdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/annojdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/annojdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/annojdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/annojdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/annojdev.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=annojdev.wordpress.com&amp;blog=9918315&amp;post=4&amp;subd=annojdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://annojdev.wordpress.com/2009/10/14/introducing-annoj/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4221ea1a8282ecd64aa42db1dc7c8ec9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akostajti</media:title>
		</media:content>
	</item>
	</channel>
</rss>
