xwork / docs / wikidocs / KeyProperty Annotation.html

        <title>XWork - 
        KeyProperty Annotation
	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">

	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
			    <td valign="top" class="pagebody">
				    <p><p/>Sets the KeyProperty for type conversion.</p>

<h2><a name="KeyPropertyAnnotation-Usage"></a>Usage</h2>

<p><p/>The KeyProperty annotation must be applied at field or method level.
<p/>This annotation should be used with Generic types, if the key property of the key element needs to be specified.</p>

<h2><a name="KeyPropertyAnnotation-Parameters"></a>Parameters</h2>

<td>The key property value.</td>

<h2><a name="KeyPropertyAnnotation-Examples"></a>Examples</h2>

<div class="code"><div class="codeContent">
<pre class="code-java"><span class="code-comment">// The key property <span class="code-keyword">for</span> User objects within the users collection is the &lt;code&gt;userName&lt;/code&gt; attribute.
</span>@KeyProperty( value = <span class="code-quote">"userName"</span> )
<span class="code-keyword">protected</span> List&lt;User&gt; users = <span class="code-keyword">null</span>;</pre>