Package org.openrewrite.java
Interface JavaTypeSignatureBuilder
- All Known Implementing Classes:
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
Modifier and TypeMethodDescriptionarraySignature(Object type) classSignature(Object type) genericSignature(Object type) When generic type variables are cyclic, likeU extends Cyclic<? extends U>, represent the cycle with the bound name, likeGeneric{U extends Cyclic<? extends U>}.parameterizedSignature(Object type) primitiveSignature(Object type)
-
Method Details
-
signature
- Parameters:
type- A type object.- Returns:
- The type signature. If
tis null, the signature is{undefined}.
-
arraySignature
- Parameters:
type- An array type.- Returns:
- Formatted like
Integer[].
-
classSignature
- Parameters:
type- A class type.- Returns:
- Formatted like
java.util.List.
-
genericSignature
When generic type variables are cyclic, likeU extends Cyclic<? extends U>, represent the cycle with the bound name, likeGeneric{U extends Cyclic<? extends U>}. When the bound isObject(regardless of whether that bound is implicit or explicit in the source code),the type variable is considered invariant and the bound is omitted. SoGeneric{List<?>}is favored overGeneric{List<? extends java.lang.Object>}.- Parameters:
type- A generic type.- Returns:
- Formatted like
Generic{U extends java.lang.Comparable}(covariant) orGeneric{U super java.lang.Comparable}(contravariant).
-
parameterizedSignature
- Parameters:
type- A parameterized type.- Returns:
- Formatted like
java.util.List<java.util.List<Integer>>.
-
primitiveSignature
- Parameters:
type- A primitive type.- Returns:
- Formatted like
Integer.
-