patterntesting.runtime.util
Class SignatureHelper

Package class diagram package SignatureHelper
java.lang.Object
  extended by patterntesting.runtime.util.SignatureHelper

public class SignatureHelper
extends Object

The Class SignatureHelper.

Since:
03.04.2009
Version:
$Revision: 1.6 $
Author:
oliver

Method Summary
static ConstructorSignature getAsSignature(Constructor<?> ctor)
          Gets the as signature.
static MethodSignature getAsSignature(Method method)
          Gets the as signature.
static Signature getAsSignature(String label)
          Gets the as signature.
static String getAsString(Signature sig)
          The difference to Signature.toString() is that in case of a methode or constructor the return type is not part of result.
static String getAsString(String type, Signature sig)
          Gets the as string.
static boolean hasReturnType(Signature signature)
          Returns true if the given signature is a MethodSignature and the return value is not of type 'void'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAsString

public static String getAsString(Signature sig)
The difference to Signature.toString() is that in case of a methode or constructor the return type is not part of result.

Parameters:
sig - the sig
Returns:
the given signature as string

getAsString

public static String getAsString(String type,
                                 Signature sig)
Gets the as string.

Parameters:
type - the type
sig - the sig
Returns:
the as string

getAsSignature

public static MethodSignature getAsSignature(Method method)
Gets the as signature.

Parameters:
method - the method
Returns:
the as signature

getAsSignature

public static ConstructorSignature getAsSignature(Constructor<?> ctor)
Gets the as signature.

Parameters:
ctor - the ctor
Returns:
the as signature

getAsSignature

public static Signature getAsSignature(String label)
                                throws ClassNotFoundException,
                                       SecurityException,
                                       NoSuchMethodException
Gets the as signature.

Parameters:
label - e.g. "java.lang.String.substring(int)" or "new java.lang.String()
Returns:
the given label as Signature
Throws:
ClassNotFoundException - the class not found exception
NoSuchMethodException - the no such method exception
SecurityException - the security exception

hasReturnType

public static boolean hasReturnType(Signature signature)
Returns true if the given signature is a MethodSignature and the return value is not of type 'void'.

Parameters:
signature - the signature
Returns:
true, if successful
Since:
1.3.1


Copyright © 2002–2014 PatternTesting Team. All rights reserved.