Class JavaReflectionTypeSignatureBuilder

java.lang.Object
org.openrewrite.java.internal.JavaReflectionTypeSignatureBuilder
All Implemented Interfaces:
JavaTypeSignatureBuilder

public class JavaReflectionTypeSignatureBuilder extends Object implements JavaTypeSignatureBuilder
  • Constructor Details

    • JavaReflectionTypeSignatureBuilder

      public JavaReflectionTypeSignatureBuilder()
  • Method Details

    • signature

      public String signature(@Nullable Object t)
      Specified by:
      signature in interface JavaTypeSignatureBuilder
      Parameters:
      t - A type object.
      Returns:
      The type signature. If t is null, the signature is {undefined}.
    • arraySignature

      public String arraySignature(Object type)
      Specified by:
      arraySignature in interface JavaTypeSignatureBuilder
      Parameters:
      type - An array type.
      Returns:
      Formatted like Integer[].
    • classSignature

      public String classSignature(Object type)
      Specified by:
      classSignature in interface JavaTypeSignatureBuilder
      Parameters:
      type - A class type.
      Returns:
      Formatted like java.util.List.
    • genericSignature

      public String genericSignature(Object type)
      Description copied from interface: JavaTypeSignatureBuilder
      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>}.

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

      public String parameterizedSignature(Object type)
      Specified by:
      parameterizedSignature in interface JavaTypeSignatureBuilder
      Parameters:
      type - A parameterized type.
      Returns:
      Formatted like java.util.List<java.util.List<Integer>>.
    • primitiveSignature

      public String primitiveSignature(Object type)
      Specified by:
      primitiveSignature in interface JavaTypeSignatureBuilder
      Parameters:
      type - A primitive type.
      Returns:
      Formatted like Integer.
    • methodSignature

      public String methodSignature(Constructor<?> ctor, String declaringTypeName)
    • methodSignature

      public String methodSignature(Method method, String declaringTypeName)
    • variableSignature

      public String variableSignature(Field field)