001 /******************************************************************************* 002 * Portions created by Sebastian Thomschke are copyright (c) 2005-2011 Sebastian 003 * Thomschke. 004 * 005 * All Rights Reserved. This program and the accompanying materials 006 * are made available under the terms of the Eclipse Public License v1.0 007 * which accompanies this distribution, and is available at 008 * http://www.eclipse.org/legal/epl-v10.html 009 * 010 * Contributors: 011 * Sebastian Thomschke - initial implementation. 012 *******************************************************************************/ 013 package net.sf.oval.context; 014 015 import java.lang.reflect.Method; 016 017 import net.sf.oval.internal.util.SerializableMethod; 018 import net.sf.oval.internal.util.StringUtils; 019 020 /** 021 * @author Sebastian Thomschke 022 */ 023 public class MethodExitContext extends OValContext 024 { 025 private static final long serialVersionUID = 1L; 026 027 private final SerializableMethod method; 028 029 public MethodExitContext(final Method method) 030 { 031 this.method = SerializableMethod.getInstance(method); 032 } 033 034 /** 035 * @return Returns the method. 036 */ 037 public Method getMethod() 038 { 039 return method.getMethod(); 040 } 041 042 /** 043 * {@inheritDoc} 044 */ 045 @Override 046 public String toString() 047 { 048 return method.getDeclaringClass().getName() + "." + method.getName() + "(" 049 + StringUtils.implode(method.getParameterTypes(), ",") + ")"; 050 } 051 }