Package aQute.bnd.compatibility
Class Signatures
- java.lang.Object
-
- aQute.bnd.compatibility.Signatures
-
public class Signatures extends java.lang.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 Summary
Constructors Constructor Description Signatures()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getSignature(java.lang.Class<?> c)
Calculate the generic signature of a Class.java.lang.String
getSignature(java.lang.Object c)
Calculate the generic signature of a Class,Method,Field, or Constructor.java.lang.String
getSignature(java.lang.reflect.Constructor<?> c)
Calculate the generic signature of a Constructor.java.lang.String
getSignature(java.lang.reflect.Field f)
Calculate the generic signature of a Field.java.lang.String
getSignature(java.lang.reflect.Method m)
Calculate the generic signature of a Method.java.lang.String
normalize(java.lang.String signature)
Normalize a signature to make sure the name of the variables are always the same.
-
-
-
Method Detail
-
getSignature
public java.lang.String getSignature(java.lang.Object c) throws java.lang.Exception
Calculate the generic signature of a Class,Method,Field, or Constructor.- Throws:
java.lang.Exception
-
getSignature
public java.lang.String getSignature(java.lang.Class<?> c) throws java.lang.Exception
Calculate the generic signature of a Class. A Class consists of:class ::= declaration? reference reference*
- Throws:
java.lang.Exception
-
getSignature
public java.lang.String getSignature(java.lang.reflect.Method m) throws java.lang.Exception
Calculate the generic signature of a Method. A Method consists of:method ::= declaration? '(' reference* ')' reference
- Throws:
java.lang.Exception
-
getSignature
public java.lang.String getSignature(java.lang.reflect.Constructor<?> c) throws java.lang.Exception
Calculate the generic signature of a Constructor. A Constructor consists of:constructor ::= declaration? '(' reference* ')V'
- Parameters:
c
-- Throws:
java.lang.Exception
-
getSignature
public java.lang.String getSignature(java.lang.reflect.Field f) throws java.lang.Exception
Calculate the generic signature of a Field. A Field consists of:constructor ::= reference
- Throws:
java.lang.Exception
-
normalize
public java.lang.String normalize(java.lang.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
-
-