001: //
002: // This file is part of the prose package.
003: //
004: // The contents of this file are subject to the Mozilla Public License
005: // Version 1.1 (the "License"); you may not use this file except in
006: // compliance with the License. You may obtain a copy of the License at
007: // http://www.mozilla.org/MPL/
008: //
009: // Software distributed under the License is distributed on an "AS IS" basis,
010: // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
011: // for the specific language governing rights and limitations under the
012: // License.
013: //
014: // The Original Code is prose.
015: //
016: // The Initial Developers of the Original Code are Angela Nicoara and Gerald Linhofer.
017: // All Rights Reserved.
018: //
019: // Contributor(s):
020: // $Id$
021: // =====================================================================
022: //
023: // (history at end)
024: //
025:
026: package ch.ethz.prose.engine;
027:
028: import java.lang.reflect.Method;
029:
030: import ch.ethz.jvmai.JoinPointKinds;
031: import ch.ethz.jvmai.ClassSpecific;
032:
033: /**
034: * Represents a method redefine request based a <code>MethodRedefineJoinPoint<code>.
035: *
036: * @version $Revision$
037: * @author Angela Nicoara
038: * @author Johann Gyger
039: */
040: public class MethodRedefineRequest extends JoinPointRequest implements
041: JoinPointKinds, ClassSpecific {
042:
043: protected final Method oldMethod;
044:
045: /**
046: * Create a new method redefine request.
047: *
048: * @param oldMethod method that will be redefined
049: * @param o owner of this request
050: */
051: public MethodRedefineRequest(Method oldMethod, JoinPointManager o) {
052: super (o);
053: this .oldMethod = oldMethod;
054: }
055:
056: public int getMask() {
057: return MASK_METHOD_REDEFINE_JP | MASK_CODE_JP;
058: }
059:
060: public String getKind() {
061: return KIND_METHOD_REDEFINE_JP;
062: }
063:
064: public Class getTargetClass() {
065: return oldMethod.getDeclaringClass();
066: }
067:
068: public Method getMethod() {
069: return oldMethod;
070: }
071:
072: public boolean equals(Object other) {
073: MethodRedefineRequest otherReq;
074: if (other instanceof MethodRedefineRequest)
075: otherReq = (MethodRedefineRequest) other;
076: else
077: return false;
078: return oldMethod.equals(otherReq.oldMethod);
079: }
080:
081: public int hashCode() {
082: return (getMethod().hashCode() + 2);
083: }
084:
085: public String toString() {
086: return "MethodRedefineRequest on "
087: + oldMethod.getDeclaringClass().getName() + "."
088: + oldMethod.getName();
089: }
090:
091: protected void setWatch(Object listeners) {
092: throw new RuntimeException("Not supported");
093: }
094:
095: protected void clearWatch() {
096: throw new RuntimeException("Not supported");
097: }
098:
099: }
100:
101: //======================================================================
102: //
103: // $Log$
104: //
|