<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to HowToDependentValue</title><link>https://sourceforge.net/p/openpatrician/wikimig/HowToDependentValue/</link><description>Recent changes to HowToDependentValue</description><atom:link href="https://sourceforge.net/p/openpatrician/wikimig/HowToDependentValue/feed" rel="self"/><language>en</language><lastBuildDate>Fri, 23 Dec 2016 21:12:13 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/openpatrician/wikimig/HowToDependentValue/feed" rel="self" type="application/rss+xml"/><item><title>HowToDependentValue modified by Sahits GmbH</title><link>https://sourceforge.net/p/openpatrician/wikimig/HowToDependentValue/</link><description>&lt;div class="markdown_content"&gt;&lt;h2 id="howto-use-dependentvalue"&gt;HowTo use @DependentValue&lt;/h2&gt;
&lt;p&gt;The annotation &lt;code&gt;@DependentValue&lt;/code&gt; works in a very similar way as &lt;code&gt;@Value&lt;/code&gt; at least in it's effects. However there is a bit more to it. The backing value is tretrieved through an &lt;code&gt;IPropertyInitializer&lt;/code&gt; which reads in the property file that holds the values. However in the property file there are multiple values defined for each key. They are distinguished by an additional segment of the key and this additional segment is defined through the implementation of &lt;code&gt;IPropertyInitializer&lt;/code&gt;, thus creating the complete key name.&lt;br/&gt;
These values however are not automatically replaced in the bean as with &lt;code&gt;@Value&lt;/code&gt;, they require to be initialized through &lt;code&gt;ch.sahits.game.openpatrician.util.spring.DependentPropertyInitializer&lt;/code&gt; which is also wired into the bean and called in a post-construct method:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;propertyInitializer.initializeAnnotatedFields(this);
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This is used to inject values that are dependent on the difficulty. The &lt;code&gt;IPropertyInitializer&lt;/code&gt; is setup with the suffix of the game difficulty and thereby the appropriate values can be loaded.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sahits GmbH</dc:creator><pubDate>Fri, 23 Dec 2016 21:12:13 -0000</pubDate><guid>https://sourceforge.net0a4f01ce4143035cc8604f4b3b4e87c762c8553f</guid></item></channel></rss>