/** * Append an array type signature * * @param type Array type to append * @param nullable Nullness of type * @param output Output to append to * @param <A> Type of output * @return Supplied output to append to */ public <A extends Appendable> A appendArrayTypeSignature(Generic type, Nullness nullable, A output) { try { output.append('[').append(nullable.getMarker()); appendJavaTypeSignature(Validate.notNull(type.getComponentType()), Nullness.UNDEFINED, output); return output; } catch (Exception e) { throw new RuntimeException(String.format("Could not write array type %s", type)); } }
/** * Append an array type signature * * @param type Array type to append * @param nullable Nullness of type * @param output Output to append to * @param <A> Type of output * @return Supplied output to append to */ public <A extends Appendable> A appendArrayTypeSignature(Generic type, Nullness nullable, A output) { try { output.append('[').append(nullable.getMarker()); appendJavaTypeSignature(Validate.notNull(type.getComponentType()), Nullness.UNDEFINED, output); return output; } catch (Exception e) { throw new RuntimeException(String.format("Could not write array type %s", type)); } }
/** * Append a method signature * * @param method Method to append signature of * @param output Output to append to * @param <A> Type of output * @return Supplied output to append to */ public <A extends Appendable> A appendMethodSignature(MethodDescription method, A output) { try { if (!method.getTypeVariables().isEmpty()) { appendTypeParameters(method.getTypeVariables(), output); } output.append('('); for (ParameterDescription parameter : method.getParameters()) { Nullness nullable = this.nullability.getParameterNullability(parameter); appendJavaTypeSignature(parameter.getType(), nullable, output); } output.append(')'); Nullness nullable = this.nullability.getReturnValueNullability(method); appendJavaTypeSignature(method.getReturnType(), nullable, output); return output; } catch (Exception e) { throw new RuntimeException(String.format("Could not write method signature %s", method)); } }
/** * Append a method signature * * @param method Method to append signature of * @param output Output to append to * @param <A> Type of output * @return Supplied output to append to */ public <A extends Appendable> A appendMethodSignature(MethodDescription method, A output) { try { if (!method.getTypeVariables().isEmpty()) { appendTypeParameters(method.getTypeVariables(), output); } output.append('('); for (ParameterDescription parameter : method.getParameters()) { Nullness nullable = this.nullability.getParameterNullability(parameter); appendJavaTypeSignature(parameter.getType(), nullable, output); } output.append(')'); Nullness nullable = this.nullability.getReturnValueNullability(method); appendJavaTypeSignature(method.getReturnType(), nullable, output); return output; } catch (Exception e) { throw new RuntimeException(String.format("Could not write method signature %s", method)); } }