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

import org.jboss.aop.InstanceAdvisor;
import org.jboss.util.id.GUID;

import java.io.ObjectStreamException;
import java.io.Serializable;

/**
 * Comment
 *
 * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
 * @version $Revision: 1.1.8.2 $
 */
public class MarshalledInterfaceProxy implements Serializable
{
   private Class[] interfaces;
   private ProxyMixin[] mixins;
   private InstanceAdvisor advisor;
   private GUID guid;

   protected MarshalledInterfaceProxy()
   {
   }

   public MarshalledInterfaceProxy(GUID guid, Class[] intfs, ProxyMixin[] mixins, InstanceAdvisor advisor)
   {
      this.guid = guid;
      this.advisor = advisor;
      this.interfaces = intfs;
      this.mixins = mixins;
   }

   public Object readResolve() throws ObjectStreamException
   {
      try
      {
         return ProxyFactory.createInterfaceProxy(guid, Thread.currentThread().getContextClassLoader(), interfaces, mixins, advisor);
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
      }
   }
}
