<?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>Xebia Blog &#187; type migration</title>
	<atom:link href="http://blog.xebia.com/tag/type-migration/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xebia.com</link>
	<description>Software development done right!</description>
	<lastBuildDate>Wed, 01 Feb 2012 00:30:00 +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>IntelliJ 8: Type Migration</title>
		<link>http://blog.xebia.com/2008/11/07/intellij-8-type-migration/</link>
		<comments>http://blog.xebia.com/2008/11/07/intellij-8-type-migration/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 07:00:03 +0000</pubDate>
		<dc:creator>Erik Pragt</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[IntelliJ]]></category>
		<category><![CDATA[type migration]]></category>

	<!-- AutoMeta Start -->
	<category></category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://blog.xebia.com/?p=792</guid>
		<description><![CDATA[Coding is refactoring. What starts with a great idea, might prove incorrect in the future. A simple example is the following code: public class Address { private String streetName; private Integer houseNumber; // getters and setters } While initialy, a housenumber represented as an Integer might sound like a valid thing to do, chances are [...]]]></description>
			<content:encoded><![CDATA[<p>Coding is refactoring. What starts with a great idea, might prove incorrect in the future. A simple example is the following code:</p>
<pre lang="java">
public class Address {
    private String streetName;
    private Integer houseNumber;

    // getters and setters
}
</pre>
<p><span id="more-792"></span><br />
While initialy, a housenumber represented as an Integer might sound like a valid thing to do, chances are that this might change in the future when you need to handle<br />
housenumbers like &#8217;21A&#8217;, or &#8217;19 4th story&#8217;. However, your UI expects this to be a Integer. Your domain expects this to be an integer. Your service layer expects this to be an integer.<br />
I guess you catch my drift. Until now, it took quite some effort to refactor this, since you cannot just rename an Integer to a String. Now, with the help of Type Migration, this is possible!</p>
<p>By selecting the Integer type in the Address, and pressing Ctrl+Shift+F6 (Refactor -> Type Migration), you can change the type of the housenumber to be a String. The<br />
great thing about this is that the getters and setters automatically change, but also methods which call this method. For example, if I have this code in the Person class:</p>
<pre lang="java">
    public Integer getPersonHouseNumber() {
        return address.getHouseNumber();
    }
</pre>
<p>Changing the type of the house number property in the address class will have the following result:</p>
<pre lang="java">
    public String getPersonHouseNumber() {
        return address.getHouseNumber();
    }
</pre>
<p>So, the type did not only change in the Address class, but in the whole chain of method calls! This saves a lot of time in refactoring, and means that when changing<br />
types at the DAO level, this change will automatically affect the whole call chain, for example up to the level of the UI.</p>
<div name="googleone_share_1" style="position:relative;z-index:5;float: right; margin-left: 10px;"><g:plusone size="small" count="1" href="http://blog.xebia.com/2008/11/07/intellij-8-type-migration/"></g:plusone></div><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.xebia.com%2F2008%2F11%2F07%2Fintellij-8-type-migration%2F&amp;title=IntelliJ%208%3A%20Type%20Migration" id="wpa2a_2"><img src="http://blog.xebia.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.xebia.com/2008/11/07/intellij-8-type-migration/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blog.xebia.com/tag/type-migration/feed/ ) in 0.52389 seconds, on Feb 9th, 2012 at 5:18 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 9th, 2012 at 6:18 pm UTC -->
