Class MethodSignature

java.lang.Object
org.djutils.reflection.MethodSignature
All Implemented Interfaces:
Serializable

public class MethodSignature extends Object implements Serializable
A method descriptor represents the parameters that the method takes and the value that it returns. It is a series of characters generated by the grammar described at The Java Virtual Machine Specification: Method Descriptors .

Copyright (c) 2002-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.

Author:
Peter Jacobs, Niels Lang, Alexander Verbraeck
See Also:
  • Constructor Details

    • MethodSignature

      public MethodSignature(String value)
      constructs a new MethodSignature.
      Parameters:
      value - String; the descriptor
    • MethodSignature

      public MethodSignature(Method method)
      constructs a new MethodSignature.
      Parameters:
      method - Method; the method
    • MethodSignature

      public MethodSignature(Constructor<?> constructor)
      constructs a new MethodSignature.
      Parameters:
      constructor - Constructor<?>; the constructor
  • Method Details

    • getParameterDescriptor

      public String getParameterDescriptor()
      Returns:
      Returns the parameterDescriptor
    • getParameterTypes

      public Class<?>[] getParameterTypes() throws ClassNotFoundException
      returns the parameterTypes.
      Returns:
      ClassDescriptor[] the result
      Throws:
      ClassNotFoundException - on incomplete classPath
    • getReturnDescriptor

      public String getReturnDescriptor()
      Returns:
      Returns the returnDescriptor.
    • getReturnType

      public Class<?> getReturnType() throws ClassNotFoundException
      returns the returnType of this methodDescriptor.
      Returns:
      Returns the returnType
      Throws:
      ClassNotFoundException - on incomplete classPath
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getParameterDescriptor

      public static String getParameterDescriptor(String methodDescriptor)
      Parameters:
      methodDescriptor - String; the methodDescriptor
      Returns:
      Returns the parameterDescriptor
    • getParameterTypes

      public static Class<?>[] getParameterTypes(String methodDescriptor) throws ClassNotFoundException
      returns the parameterTypes.
      Parameters:
      methodDescriptor - String; the string
      Returns:
      ClassDescriptor[] the result
      Throws:
      ClassNotFoundException - on incomplete classPath
    • getReturnDescriptor

      public static String getReturnDescriptor(String methodDescriptor)
      Parameters:
      methodDescriptor - String; the methodDescriptor
      Returns:
      Returns the returnDescriptor
    • getReturnType

      public static Class<?> getReturnType(String methodDescriptor) throws ClassNotFoundException
      returns the returnType of this methodDescriptor.
      Parameters:
      methodDescriptor - String; the returnDescriptor
      Returns:
      Returns the returnType
      Throws:
      ClassNotFoundException - on incomplete classPath