Apache Struts 2 Documentation > Home > Guides > Core Developers Guide > Annotations > Key Annotation
Added by Rainer Hermanns, last edited by Don Brown on Nov 14, 2006  (view change)

Sets the Key for type conversion.


The Key annotation must be applied at field or method level.


Parameter Required Default Description
value no java.lang.Object.class The key property value.


// The key property for User objects within the users collection is the <code>userName</code> attribute.
@Key( value = java.lang.Long.class )
private Map<Long, User> userMap;