com.retek.commons.component.impl
Class FieldMap

java.lang.Object
  extended byjava.util.AbstractMap
      extended bycom.retek.commons.component.impl.FieldMap
All Implemented Interfaces:
java.util.Map

public final class FieldMap
extends java.util.AbstractMap

A FieldMap exposes a wrapped object's public fields as a Map.


Constructor Summary
FieldMap(java.lang.Object obj)
           
 
Method Summary
 java.util.Set entrySet()
           
 boolean equals(java.lang.Object thatObject)
          Returns true if thatObject is a Map that is equal to this field map's object.
 boolean equalsFieldMap(FieldMap that)
          A replacement for equals used by SecondClassDto.equalsDto().
 java.lang.Object get(java.lang.String key)
           
 int hashCode()
           
 java.util.Set keySet()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 java.lang.Object remove(java.lang.Object key)
           
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, get, isEmpty, putAll, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FieldMap

public FieldMap(java.lang.Object obj)
Method Detail

keySet

public java.util.Set keySet()

entrySet

public java.util.Set entrySet()

get

public java.lang.Object get(java.lang.String key)

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)

remove

public java.lang.Object remove(java.lang.Object key)

equals

public final boolean equals(java.lang.Object thatObject)
Returns true if thatObject is a Map that is equal to this field map's object. NOTE: this implementation ignores all entries in thatObject that don't correspond to fields in this object. This is OK since FieldMap is only used to compare DTOs of the same type (and snapshots of them). This method is invoked frequently to see if a DTO is dirty, etc.


hashCode

public int hashCode()

equalsFieldMap

public final boolean equalsFieldMap(FieldMap that)
                             throws java.lang.IllegalArgumentException,
                                    java.lang.IllegalAccessException
A replacement for equals used by SecondClassDto.equalsDto(). This version assumes that thatFieldMap is for the same class of Dto. It is also allowed to throw exceptions (rather than pay the penalty for a try-catch block). *

Parameters:
that - another FieldMap on the same Dto class
Returns:
true if the underlying dtos have equal field values.
Throws:
java.lang.IllegalArgumentException - if that.obj.getClass() is not this.obj.getClass()
java.lang.IllegalAccessException - shouldn't ever happen
See Also:
SecondClassDto.equalsDto(Object)


Copyright © 2004 Retek Inc. All Rights Reserved. - Generated at Fri, 10/22/2004 07:28