com.sun.jini.jeri.internal.runtime
Class SameClassKey

java.lang.Object
  extended by com.sun.jini.jeri.internal.runtime.SameClassKey

final class SameClassKey
extends Object

Wraps collection elements (such as hash table keys) so that two wrapped elements are only considered to be equal if they have the same class (as well as being equal by Object.equals). This class is used to wrap elements in a collection when their classes are not all trusted, with the restriction that only elements of the same class can be considered equal. This class never invokes Object.equals on an underlying element with an argument that has a different class than the element, to avoid leaking sensitive information to untrusted elements. For this isolation scheme to work, the Object.equals method of any trusted element class should not invoke comparison methods (such as Object.equals) on any pluggable component without first verifying that the component's implementation is at least as trusted as the implementation of the corresponding component in the Object.equals argument (such as by verifying that the corresponding component objects have the same actual class). If any such verification fails, the Object.equals method should return false without invoking a comparison method on the component. Furthermore, these guidelines should be recursively obeyed by the comparison methods of each such component for its subcomponents.

Author:
Sun Microsystems, Inc.

Field Summary
private  Object key
           
 
Constructor Summary
SameClassKey(Object key)
           
 
Method Summary
 boolean equals(Object obj)
           
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

private final Object key
Constructor Detail

SameClassKey

SameClassKey(Object key)
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.