/*
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package org.jboss.aop.advice;


/**
 *
 * @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
 * @version $Revision: 1.1.8.2 $
 */
public class PrecedenceDefEntry
{
   String interceptorClass;
   String adviceMethod;
   
   public PrecedenceDefEntry(String interceptorClass,
         String adviceMethod)
   {
      this.interceptorClass = interceptorClass;
      this.adviceMethod = adviceMethod;
   }
   
   public String getAdviceMethod()
   {
      return adviceMethod;
   }
   
   public String getInterceptorClass()
   {
      return interceptorClass;
   }
   
   
   public boolean equals(Object o)
   {
      if (o instanceof PrecedenceDefEntry)
      {
         PrecedenceDefEntry pde = (PrecedenceDefEntry)o;
         
         if (this.interceptorClass.equals(pde.interceptorClass))
         {
            if (this.adviceMethod == null)
            {
               return pde.adviceMethod == null;
            }
            else if (pde.adviceMethod != null)
            {
               return this.adviceMethod.equals(pde.adviceMethod);
            }
         }
      }
      
      return false;
   }
   
   
   public String toString()
   {
      return "Entry: interceptorClass=" + interceptorClass + "; adviceMethod=" + adviceMethod;
   }
   
}
