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

jadex.platform.service.remote.replacements.DefaultEqualsMethodReplacement Maven / Gradle / Ivy

Go to download

The Jadex platform package contains implementations of platform services as well as the platform component itself.

There is a newer version: 3.0.117
Show newest version
package jadex.platform.service.remote.replacements;

import java.lang.reflect.Proxy;

import jadex.commons.transformation.annotations.Alias;
import jadex.platform.service.remote.IMethodReplacement;

/**
 *  Default replacement code for equals() method.
 */
@Alias("jadex.base.service.remote.replacements.DefaultEqualsMethodReplacement")
public class DefaultEqualsMethodReplacement implements IMethodReplacement
{
	/**
	 *  Invoke the method on the given object with the given args.
	 */
	public Object invoke(Object obj, Object[] args)
	{
		// Todo: compare proxy infos instead of invocation handlers?
		return Boolean.valueOf(args[0]!=null && Proxy.isProxyClass(args[0].getClass())
			&& Proxy.getInvocationHandler(obj).equals(Proxy.getInvocationHandler(args[0])));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy