/************************************************
 * Copyright (c) Shen Li. All rights reserved.  *
 * http://joyaop.sourceforge.net                *
 * -------------------------------------------- *
 * Distributable under LGPL license.            *
 * See terms of license at gnu.org.             *
 ************************************************/
package net.sf.joyaop.impl;

import net.sf.joyaop.framework.Aspect;
import net.sf.joyaop.framework.Pointcut;

/**
 * @author Shen Li
 */
abstract class AspectImpl implements Aspect {
    private Pointcut pointcut;
    private Class aspectClass;

    public Pointcut getPointcut() {
        return pointcut;
    }

    public void setPointcut(Pointcut pointcut) {
        this.pointcut = pointcut;
    }

    public Class getAspectClass() {
        return aspectClass;
    }

    public void setAspectClass(Class aspectClass) {
        this.aspectClass = aspectClass;
    }

    public boolean equals(Object object) {
        if (this == object) {
            return true;
        }
        if (object == null) {
            return false;
        }
        if (getClass() == object.getClass()) {
            return true;
        }
        if (aspectClass != ((AspectImpl) object).aspectClass) {
            return false;
        }
        if (!pointcut.equals((((AspectImpl) object)).pointcut)) {
            return false;
        }
        return true;
    }

    public int hashCode() {
        return getAspectClass().hashCode() * 31 + pointcut.hashCode();
    }
}
