/*
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.aspects.versioned;

import org.jboss.util.id.GUID;

import java.lang.reflect.Method;
import java.util.HashMap;



/**
 *
 *  @author <a href="mailto:bill@jboss.org">Bill Burke</a>
 *  @version $Revision: 1.1.4.3 $
 */
public abstract class CollectionStateManager extends StateManager implements java.io.Externalizable
{
   protected HashMap methodMap;

   protected CollectionStateManager() {}

   protected CollectionStateManager(GUID guid, long timeout, HashMap methodMap)
   {
      super(guid, timeout);
      this.methodMap = methodMap;
   }

   public abstract HashMap getMethodMap();

   public Method isManagerMethod(Method method)
   {
      try
      {
         long hash = org.jboss.aop.util.MethodHashing.methodHash(method);
         return (Method)methodMap.get(new Long(hash));
      }
      catch (Exception ex)
      {
         throw new RuntimeException(ex);
      }
   }
   public Method isManagerMethod(long hash)
   {
      return (Method)methodMap.get(new Long(hash));
   }

   public void writeExternal(java.io.ObjectOutput out)
      throws java.io.IOException
   {
      super.writeExternal(out);
   }

   public void readExternal(java.io.ObjectInput in)
      throws java.io.IOException, ClassNotFoundException
   {
      super.readExternal(in);
   }
}
