Class Signatures

java.lang.Object
aQute.bnd.compatibility.Signatures

public class Signatures extends Object
This class can convert a Class, Field, Method or constructor to a generic signature and it can normalize a signature. Both are methods. Normalized signatures can be string compared and match even if the type variable names differ.
Version:
$Id: d9bcbd3da7e14f43f4fe3db7e1f6ef4c27ff122c $
  • Constructor Details

    • Signatures

      public Signatures()
  • Method Details

    • getSignature

      public String getSignature(Object c) throws Exception
      Calculate the generic signature of a Class,Method,Field, or Constructor.
      Throws:
      Exception
    • getSignature

      public String getSignature(Class<?> c) throws Exception
      Calculate the generic signature of a Class. A Class consists of:
       class ::= declaration? reference reference*
       
      Throws:
      Exception
    • getSignature

      public String getSignature(Method m) throws Exception
      Calculate the generic signature of a Method. A Method consists of:
       method ::= declaration? '(' reference* ')' reference
       
      Throws:
      Exception
    • getSignature

      public String getSignature(Constructor<?> c) throws Exception
      Calculate the generic signature of a Constructor. A Constructor consists of:
        constructor ::= declaration? '(' reference* ')V'
       
      Parameters:
      c -
      Throws:
      Exception
    • getSignature

      public String getSignature(Field f) throws Exception
      Calculate the generic signature of a Field. A Field consists of:
       constructor ::= reference
       
      Throws:
      Exception
    • normalize

      public String normalize(String signature)
      Normalize a signature to make sure the name of the variables are always the same. We change the names of the type variables to _n, where n is an integer. n is incremented for every new name and already used names are replaced with the _n name.
      Returns:
      a normalized signature