net.floodlightcontroller.devicemanager.internal
Class IndexedEntity

java.lang.Object
  extended by net.floodlightcontroller.devicemanager.internal.IndexedEntity

public class IndexedEntity
extends java.lang.Object

This is a thin wrapper around Entity that allows overriding the behavior of Object.hashCode() and Object.equals(Object) so that the keying behavior in a hash map can be changed dynamically

Author:
readams

Field Summary
protected  Entity entity
           
protected  java.util.EnumSet<IDeviceService.DeviceField> keyFields
           
protected static org.slf4j.Logger logger
           
 
Constructor Summary
IndexedEntity(java.util.EnumSet<IDeviceService.DeviceField> keyFields, Entity entity)
          Create a new IndexedEntity for the given Entity using the provided key fields.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean hasNonNullKeys()
          Check whether this entity has non-null values in any of its key fields
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyFields

protected java.util.EnumSet<IDeviceService.DeviceField> keyFields

entity

protected Entity entity

logger

protected static org.slf4j.Logger logger
Constructor Detail

IndexedEntity

public IndexedEntity(java.util.EnumSet<IDeviceService.DeviceField> keyFields,
                     Entity entity)
Create a new IndexedEntity for the given Entity using the provided key fields.

Parameters:
keyFields - The key fields that will be used for computing hashCode() and equals(Object)
entity - the entity to wrap
Method Detail

hasNonNullKeys

public boolean hasNonNullKeys()
Check whether this entity has non-null values in any of its key fields

Returns:
true if any key fields have a non-null value

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