Class DataKey<T>

  • Type Parameters:
    T - The type of the object which is stored

    public abstract class DataKey<T>
    extends java.lang.Object
    A key to a piece of data associated with a Node at runtime. The key contains type information that can be used to check the type of any user data value for the key when the value is set. DataKey is abstract in order to force the creation of a subtype. That subtype is used to test for identity when looking for the user data because actual object identity would suffer from problems under serialization. So, the correct way to declare a DataKey is like this:

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

    This code was taken from the Wicket project.

    See Also:
    Node.getData(DataKey)
    • Constructor Summary

      Constructors 
      Constructor Description
      DataKey()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DataKey

        public DataKey()
    • 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)