//
// This file is part of the prose package.
//
// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
//
// The Original Code is prose.
//
// The Initial Developers of the Original Code are Angela Nicoara and Gerald Linhofer.
// All Rights Reserved.
//
// Contributor(s):
// $Id$
// =====================================================================
//
// (history at end)
//
package ch.ethz.prose.engine;
import java.lang.reflect.Method;
import ch.ethz.jvmai.JoinPointKinds;
import ch.ethz.jvmai.ClassSpecific;
/**
* Represents a method redefine request based a <code>MethodRedefineJoinPoint<code>.
*
* @version $Revision$
* @author Angela Nicoara
* @author Johann Gyger
*/
public class MethodRedefineRequest extends JoinPointRequest implements JoinPointKinds, ClassSpecific {
protected final Method oldMethod;
/**
* Create a new method redefine request.
*
* @param oldMethod method that will be redefined
* @param o owner of this request
*/
public MethodRedefineRequest(Method oldMethod, JoinPointManager o) {
super(o);
this.oldMethod = oldMethod;
}
public int getMask() {
return MASK_METHOD_REDEFINE_JP | MASK_CODE_JP;
}
public String getKind() {
return KIND_METHOD_REDEFINE_JP;
}
public Class getTargetClass() {
return oldMethod.getDeclaringClass();
}
public Method getMethod() {
return oldMethod;
}
public boolean equals(Object other) {
MethodRedefineRequest otherReq;
if (other instanceof MethodRedefineRequest)
otherReq = (MethodRedefineRequest) other;
else
return false;
return oldMethod.equals(otherReq.oldMethod);
}
public int hashCode() {
return (getMethod().hashCode() + 2);
}
public String toString() {
return "MethodRedefineRequest on " + oldMethod.getDeclaringClass().getName() + "." + oldMethod.getName();
}
protected void setWatch(Object listeners) {
throw new RuntimeException("Not supported");
}
protected void clearWatch() {
throw new RuntimeException("Not supported");
}
}
//======================================================================
//
// $Log$
//
|