Interface JavaTypeSignatureBuilder

  • All Known Implementing Classes:
    ClassgraphJavaTypeSignatureBuilder, DefaultJavaTypeSignatureBuilder, JavaReflectionTypeSignatureBuilder

    public interface JavaTypeSignatureBuilder
    In addition to the signature formats described below, implementations should provide a way of retrieving method and variable signatures, but they may have different numbers of input arguments depending on the implementation.

    Method signatures should be formatted like com.MyThing{name=add,return=void,parameters=[Integer]}, where MyThing is the declaring type, void is the return type, and Integer is a parameter.

    Variable signatures should be formatted like com.MyThing{name=MY_FIELD}.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String arraySignature​(java.lang.Object type)  
      java.lang.String classSignature​(java.lang.Object type)  
      java.lang.String genericSignature​(java.lang.Object type)
      When generic type variables are cyclic, like U extends Cyclic<? extends U>, represent the cycle with the bound name, like Generic{U extends Cyclic<? extends U>}.
      java.lang.String parameterizedSignature​(java.lang.Object type)  
      java.lang.String primitiveSignature​(java.lang.Object type)  
      java.lang.String signature​(@Nullable java.lang.Object type)  
    • Method Detail

      • signature

        java.lang.String signature​(@Nullable
                                   @Nullable java.lang.Object type)
        Parameters:
        type - A type object.
        Returns:
        The type signature. If t is null, the signature is {undefined}.
      • arraySignature

        java.lang.String arraySignature​(java.lang.Object type)
        Parameters:
        type - An array type.
        Returns:
        Formatted like Integer[].
      • classSignature

        java.lang.String classSignature​(java.lang.Object type)
        Parameters:
        type - A class type.
        Returns:
        Formatted like java.util.List.
      • genericSignature

        java.lang.String genericSignature​(java.lang.Object type)
        When generic type variables are cyclic, like U extends Cyclic<? extends U>, represent the cycle with the bound name, like Generic{U extends Cyclic<? extends U>}.

        When the bound is Object (regardless of whether that bound is implicit or explicit in the source code),the type variable is considered invariant and the bound is omitted. So Generic{List<?>} is favored over Generic{List<? extends java.lang.Object>}.

        Parameters:
        type - A generic type.
        Returns:
        Formatted like Generic{U extends java.lang.Comparable} (covariant) or Generic{U super java.lang.Comparable} (contravariant).
      • parameterizedSignature

        java.lang.String parameterizedSignature​(java.lang.Object type)
        Parameters:
        type - A parameterized type.
        Returns:
        Formatted like java.util.List<java.util.List<Integer>>.
      • primitiveSignature

        java.lang.String primitiveSignature​(java.lang.Object type)
        Parameters:
        type - A primitive type.
        Returns:
        Formatted like Integer.