org.apache.wicket
Class MetaDataKey<T>

java.lang.Object
  extended by org.apache.wicket.MetaDataKey<T>
Type Parameters:
T - The type of the object which is stored
All Implemented Interfaces:
java.io.Serializable, IClusterable

public abstract class MetaDataKey<T>
extends java.lang.Object
implements IClusterable

A key to a piece of metadata associated with a Component, Session or Application at runtime. The key contains type information that can be used to check the type of any metadata value for the key when the value is set. MetaDataKey is abstract in order to force the creation of a subtype. That subtype is used to test for identity when looking for the metadata because actual object identity would suffer from problems under serialization. So, the correct way to declare a MetaDataKey is like this:

 
 public static MetaDataKey<Role> ROLE = new MetaDataKey<Role>() { };
 
 

Author:
Jonathan Locke
See Also:
Session.getMetaData(MetaDataKey), Component.getMetaData(MetaDataKey), Application.getMetaData(MetaDataKey), Serialized Form

Constructor Summary
MetaDataKey()
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 T get(MetaDataEntry<?>[] metaData)
           
 int hashCode()
           
 MetaDataEntry<?>[] set(MetaDataEntry<?>[] metaData, java.lang.Object object)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetaDataKey

public MetaDataKey()
Constructor.

Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

get

public T get(MetaDataEntry<?>[] metaData)
Parameters:
metaData - Array of metadata to search
Returns:
The entry value

set

public MetaDataEntry<?>[] set(MetaDataEntry<?>[] metaData,
                              java.lang.Object object)
Parameters:
metaData - The array of metadata
object - The object to set, null to remove
Returns:
Any new metadata array (if it was reallocated)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.