All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.linkare.zas.aspectj.accessinfo.Signature Maven / Gradle / Ivy

package com.linkare.zas.aspectj.accessinfo;

import com.linkare.zas.api.ISignature;

/**
 * The AspectJ implementation of the ISignature interface.
 * 
 * @author Paulo Zenida
 * 
 */
public class Signature implements ISignature {

    protected org.aspectj.lang.Signature delegate;

    /**
     * 
     * @param delegate
     *            The delegate to set.
     */
    public Signature(org.aspectj.lang.Signature delegate) {
	this.delegate = delegate;
    }

    /**
     * @see org.aspectj.lang.Signature#getDeclaringType()
     */
    @SuppressWarnings("unchecked")
    public Class getDeclaringType() {
	return delegate.getDeclaringType();
    }

    /**
     * @see org.aspectj.lang.Signature#getDeclaringTypeName()
     */
    public String getDeclaringTypeName() {
	return delegate.getDeclaringTypeName();
    }

    /**
     * @see org.aspectj.lang.Signature#getModifiers()
     */
    public int getModifiers() {
	return delegate.getModifiers();
    }

    /**
     * @see org.aspectj.lang.Signature#getName()
     */
    public String getName() {
	return delegate.getName();
    }

    /**
     * @see org.aspectj.lang.Signature#toLongString()
     */
    public String toLongString() {
	return delegate.toLongString();
    }

    /**
     * @see org.aspectj.lang.Signature#toShortString()
     */
    public String toShortString() {
	return delegate.toShortString();
    }

    /**
     * @see org.aspectj.lang.Signature#toString()
     */
    @Override
    public String toString() {
	return delegate.toString();
    }

    /**
     * TODO Check this out for fields and other types of join points, without being methods.
     * 
     * @return The fully qualified name of this join point, without any return type.
     */
    public String getFullyQualifiedName() {
	final String signature = toString();
	return signature.substring(signature.indexOf(" ") + 1);
    }

    @Override
    public boolean equals(Object obj) {
	if (!(obj instanceof Signature)) {
	    return false;
	}
	final Signature other = (Signature) obj;
	return (other.delegate.toLongString().equals(this.delegate.toLongString()));
    }
}