1 23 package com.sun.appserv.management.j2ee.statistics; 24 25 import java.util.Map ; 26 import java.io.Serializable ; 27 28 import com.sun.appserv.management.util.misc.MapUtil; 29 import com.sun.appserv.management.util.misc.ObjectUtil; 30 import com.sun.appserv.management.util.misc.TypeCast; 31 32 37 public class MapGetterInvocationHandler<T> 38 extends GetterInvocationHandler<T> 39 implements Serializable 40 { 41 static final long serialVersionUID = -8751876448821319456L; 42 43 private final Map <String ,T> mMap; 44 45 48 public 49 MapGetterInvocationHandler( final Map <String ,T> map ) 50 { 51 mMap = map; 52 } 53 54 protected Map <String ,T> 55 getMap() 56 { 57 return( mMap ); 58 } 59 60 protected T 61 getValue( final String name ) 62 { 63 return( mMap.get( name ) ); 64 } 65 66 protected boolean 67 containsValue( String name ) 68 { 69 return( mMap.containsKey( name ) ); 70 } 71 72 public int 73 hashCode() 74 { 75 return ObjectUtil.hashCode( mMap ); 76 } 77 78 public boolean 79 equals( final Object rhsIn ) 80 { 81 boolean equals = false; 82 83 if ( rhsIn instanceof MapGetterInvocationHandler ) 84 { 85 final MapGetterInvocationHandler<?> rhs = 86 MapGetterInvocationHandler.class.cast( rhsIn ); 87 88 equals = MapUtil.mapsEqual( getMap(), rhs.getMap() ); 89 } 90 91 return( equals ); 92 } 93 94 95 public String 96 toString( ) 97 { 98 return( MapUtil.toString( mMap ) ); 99 } 100 } 101 102 103 104 105 106 | Popular Tags |