<?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/"
	>

<channel>
	<title>MyFunnyDev &#187; Java</title>
	<atom:link href="http://michalkuklis.com/blog/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://michalkuklis.com/blog</link>
	<description></description>
	<lastBuildDate>Sat, 31 Mar 2012 06:11:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SCJA and SCJP</title>
		<link>http://michalkuklis.com/blog/2008/11/06/scja-and-scjp/</link>
		<comments>http://michalkuklis.com/blog/2008/11/06/scja-and-scjp/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 18:22:31 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[certification]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=75</guid>
		<description><![CDATA[I&#8217;m planning to pass SCJA and SCJP at the end of this year. I will post  all the mocks and materials which I find helpful. Here is the first list: SCJA Tutorials/Books Certified-Associate-Study-Guide http://www.amazon.com/gp/product/1598729039/ref=cm_cr_asin_lnk j2ee 1.4 tutorial Mocks: http://www.scja.de/ http://www.ejavaguru.com/scjafreemockexam.php http://www.cafe4java.com/mockexams/scja/mock1/q1.php http://studyguides.scja.com/ExamScam/get.jsp?link=mockexams sun sample questions UML http://www.scribd.com/doc/2584053/Pengenalan-UML SCJP Tutorials/Books SCJP Sun Certified Programmer]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m planning to pass SCJA and SCJP at the end of this year. I will post  all the mocks and materials which I find helpful. Here is the first list:</p>
<h3>SCJA</h3>
<p><strong>Tutorials/Books</strong></p>
<ul>
<li><a href="http://www.amazon.com/Certified-Associate-Study-Guide-CX-310-019/dp/1598729020/ref=cm_cr_pr_product_top">Certified-Associate-Study-Guide</a></li>
<li><a href="http://www.amazon.com/gp/product/1598729039/ref=cm_cr_asin_lnk">http://www.amazon.com/gp/product/1598729039/ref=cm_cr_asin_lnk</a></li>
<li><a href="http://java.sun.com/j2ee/1.4/docs/tutorial/doc/">j2ee 1.4 tutorial</a></li>
</ul>
<p><strong>Mocks:</strong></p>
<ul>
<li><a href="http://www.scja.de/">http://www.scja.de/</a></li>
<li><a href="http://www.ejavaguru.com/scjafreemockexam.php">http://www.ejavaguru.com/scjafreemockexam.php</a></li>
<li><a href="http://www.cafe4java.com/mockexams/scja/mock1/q1.php">http://www.cafe4java.com/mockexams/scja/mock1/q1.php</a></li>
<li><a href="http://studyguides.scja.com/ExamScam/get.jsp?link=mockexams">http://studyguides.scja.com/ExamScam/get.jsp?link=mockexams</a></li>
<li><a href="http://uk.sun.com/training/catalog/courses/WGS-PREX-10-QUEST.xml">sun sample questions</a></li>
</ul>
<p><strong>UML</strong></p>
<ul>
<li><a href="http://www.scribd.com/doc/2584053/Pengenalan-UML">http://www.scribd.com/doc/2584053/Pengenalan-UML</a></li>
</ul>
<p></p>
<h3>SCJP</h3>
<p><strong>Tutorials/Books</strong></p>
<ul>
<li><a href="http://www.amazon.com/SCJP-Certified-Programmer-Java-310-065/dp/0071591060">SCJP Sun Certified Programmer</a></li>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2008/11/06/scja-and-scjp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Define your own Annotation Type</title>
		<link>http://michalkuklis.com/blog/2008/10/24/java-annotation-types/</link>
		<comments>http://michalkuklis.com/blog/2008/10/24/java-annotation-types/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 05:13:40 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/blog/?p=51</guid>
		<description><![CDATA[I&#8217;ve been using build-in Java annotation types (like @Overrides or @Deprecated) and those created by different vendors/services for a while now but I&#8217;ve never built my own. Here is an example of how you can define very simple annotation type and use it: &#160; import java.lang.annotation.Retention; &#160; public @interface SimpleMessageAnnotation &#123; public String message&#40;&#41;; &#125; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using build-in Java annotation types (like @Overrides or @Deprecated) and those created by different vendors/services for a while now but I&#8217;ve never built my own. Here is an example of how you can define very simple annotation type and use it:</p>

<div class="wp_syntax"><div class="code"><pre class="java">&nbsp;
<span class="kw1">import</span> <span class="co2">java.lang.annotation.Retention</span><span class="sy0">;</span>
&nbsp;
<span class="kw1">public</span> @<span class="kw1">interface</span> SimpleMessageAnnotation <span class="br0">&#123;</span>
     <span class="kw1">public</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> message<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>

<p>As you can see a declaration of the new annotation type is very similar to the Java interface declaration (add &#8216;@&#8217; symbol in front of the interface) There are some additional rules you have to follow:</p>
<ul>
<li>Method declarations should not have any parameters</li>
<li>Method declarations should not have any throws clauses</li>
<li>Return types of the method should be one of the following:<br />
primitives, String, Class, enum, array of the above types</li>
</ul>
<p>In order to annotate a class with the new type you can write:</p>

<div class="wp_syntax"><div class="code"><pre class="java">&nbsp;
@SimpleMessageAnnotation<span class="br0">&#40;</span>message <span class="sy0">=</span> <span class="st0">&quot;hello world!!!&quot;</span><span class="br0">&#41;</span>
<span class="kw1">public</span> <span class="kw1">class</span> TestAnnotation <span class="br0">&#123;</span>
&nbsp;
<span class="br0">&#125;</span></pre></div></div>

<p>Now in order to access the message value during the runtime we can use reflection API. Before we can do that we need to change the RetentionPolicy of our new annotation type to RUNTIME. We can do it by adding Retention annotation to our SimpleMessageAnnotation:</p>

<div class="wp_syntax"><div class="code"><pre class="java">&nbsp;
<span class="kw1">import</span> <span class="co2">java.lang.annotation.Retention</span><span class="sy0">;</span>
<span class="kw1">import</span> <span class="co2">static</span> java.<span class="me1">lang</span>.<span class="me1">annotation</span>.<span class="me1">RetentionPolicy</span>.<span class="me1">RUNTIME</span><span class="sy0">;</span>
&nbsp;
@Retention<span class="br0">&#40;</span>RUNTIME<span class="br0">&#41;</span>
<span class="kw1">public</span> @<span class="kw1">interface</span> SimpleMessageAnnotation <span class="br0">&#123;</span>
     <span class="kw1">public</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> message<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>

<p>This will inform the compiler about the new policy. There are 3 policies which can be used by the compiler (default is CLASS):</p>
<ul>
<li>SOURCE—Annotations are to be discarded by the compiler.</li>
<li>CLASS—Annotations are to be recorded in the class file by the compiler but need not be retained by the VM at runtime. This is the default behavior.</li>
<li>RUNTIME—Annotations are to be recorded in the class file by the compiler and retained by the VM at runtime, so they may be read reflectively.</li>
</ul>
<p>Now by using reflection API we can access our message value like this:</p>

<div class="wp_syntax"><div class="code"><pre class="java"><span class="kw1">public</span> <span class="kw1">class</span> Run <span class="br0">&#123;</span>
&nbsp;
	<span class="kw1">public</span> <span class="kw1">static</span> <span class="kw4">void</span> main<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a><span class="br0">&#91;</span><span class="br0">&#93;</span> args<span class="br0">&#41;</span> <span class="br0">&#123;</span>
&nbsp;
		Class<span class="sy0">&lt;</span>TestAnnotation<span class="sy0">&gt;</span> clazz <span class="sy0">=</span> TestAnnotation.<span class="kw1">class</span><span class="sy0">;</span>
		<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">System</span></a>.<span class="me1">out</span>.<span class="me1">println</span><span class="br0">&#40;</span>clazz.<span class="me1">getAnnotation</span><span class="br0">&#40;</span>SimpleMessageAnnotation.<span class="kw1">class</span><span class="br0">&#41;</span>.<span class="me1">message</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
	<span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div>

<p><strong>What can be annotated?</strong></p>
<ul>
<li>package</li>
<li>class ( including interface, enum)</li>
<li>method</li>
<li>field</li>
<li>local variable, formal parameter (compile time only)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2008/10/24/java-annotation-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FLEX + SPRING + IBATIS + CAIRNGORM</title>
		<link>http://michalkuklis.com/blog/2007/05/29/flex-spring-ibatis-cairngorm/</link>
		<comments>http://michalkuklis.com/blog/2007/05/29/flex-spring-ibatis-cairngorm/#comments</comments>
		<pubDate>Tue, 29 May 2007 20:31:28 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/archives/25</guid>
		<description><![CDATA[Chris Giametta wrote about how to connect all of the above together. update: Christophe Coenraets shows how to use flex with Spring here Peter Martin describes how to deploy flex on WebSphere here]]></description>
			<content:encoded><![CDATA[<p>Chris Giametta <a href="http://www.appfoundation.com/blogs/giametta/2007/05/09/flex-spring-ibatis-caringorm-bringing-it-all-together/">wrote </a>  about how to connect all of the above together.</p>
<p>update:<br />
Christophe Coenraets shows how to use flex with  Spring <a href="http://coenraets.org/flex-spring">here</a><br />
Peter Martin describes how to deploy flex on WebSphere <a href="http://weblogs.macromedia.com/pmartin/archives/2006/11/deploying_flex.cfm">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2007/05/29/flex-spring-ibatis-cairngorm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make Ant easy with Eclipse</title>
		<link>http://michalkuklis.com/blog/2007/02/12/make-ant-easy-with-eclipse/</link>
		<comments>http://michalkuklis.com/blog/2007/02/12/make-ant-easy-with-eclipse/#comments</comments>
		<pubDate>Tue, 13 Feb 2007 02:05:44 +0000</pubDate>
		<dc:creator>Michał Kuklis</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://michalkuklis.com/archives/23</guid>
		<description><![CDATA[I found this nice article about Ant in Eclipse.]]></description>
			<content:encoded><![CDATA[<p>I found <a href="http://www-128.ibm.com/developerworks/edu/os-dw-os-ecl-easyant.html">this nice article</a> about Ant in Eclipse.</p>
]]></content:encoded>
			<wfw:commentRss>http://michalkuklis.com/blog/2007/02/12/make-ant-easy-with-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

