View Javadoc
1   /*******************************************************************************
2    * Portions created by Sebastian Thomschke are copyright (c) 2005-2011 Sebastian
3    * Thomschke.
4    * 
5    * All Rights Reserved. This program and the accompanying materials
6    * are made available under the terms of the Eclipse Public License v1.0
7    * which accompanies this distribution, and is available at
8    * http://www.eclipse.org/legal/epl-v10.html
9    * 
10   * Contributors:
11   *     Sebastian Thomschke - initial implementation.
12   *******************************************************************************/
13  package net.sf.oval.context;
14  
15  import java.lang.reflect.Method;
16  
17  import net.sf.oval.internal.util.SerializableMethod;
18  
19  /**
20   * @author Sebastian Thomschke
21   */
22  public class MethodReturnValueContext extends OValContext
23  {
24  	private static final long serialVersionUID = 1L;
25  
26  	private final SerializableMethod method;
27  
28  	public MethodReturnValueContext(final Method method)
29  	{
30  		this.method = SerializableMethod.getInstance(method);
31  		this.compileTimeType = method.getReturnType();
32  	}
33  
34  	/**
35  	 * @return Returns the getter.
36  	 */
37  	public Method getMethod()
38  	{
39  		return method.getMethod();
40  	}
41  
42  	/**
43  	 * {@inheritDoc}
44  	 */
45  	@Override
46  	public String toString()
47  	{
48  		return method.getDeclaringClass().getName() + "." + method.getName() + "()";
49  	}
50  }