Author: ivaynberg
Date: Wed Oct 28 16:20:19 2009
New Revision: 830663
URL: http://svn.apache.org/viewvc?rev=830663&view=rev
Log:
WICKET-2548 added hashcode impl to metadatakey
Issue: WICKET-2548
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/MetaDataKey.java
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/MetaDataKey.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/MetaDataKey.java?rev=830663&r1=830662&r2=830663&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/MetaDataKey.java
(original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/MetaDataKey.java Wed
Oct 28 16:20:19 2009
@@ -18,12 +18,14 @@
/**
- * A key to a piece of metadata associated with a Component 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 on the given Component. 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 = new
MetaDataKey(Role.class) { }
+ * A key to a piece of metadata associated with a Component 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 on the given Component. 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 = new
+ * MetaDataKey(Role.class) { }
*
* @author Jonathan Locke
*
@@ -41,13 +43,19 @@
{
}
+ @Override
+ public int hashCode()
+ {
+ return getClass().hashCode();
+ }
+
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj)
{
- return obj != null && getClass().isInstance(obj);
+ return obj != null && getClass().equals(obj.getClass());
}
/**