/** * Append type arguments * * @param buf Buffer to append to * @param typeArguments Type arguments * @return <code>true</code> if any nullability information was written * @throws IOException I'm sorry, this usually doesn't happen to me... */ protected boolean appendTypeArguments(StringBuilder buf, TypeList.Generic typeArguments) throws IOException { String plainTypeVariables = this.signatureWriter.appendTypeArguments(typeArguments, new StringBuilder()) .toString(); String annotatedTypeVariables = this.signatureWriter.appendTypeArguments(typeArguments, new StringBuilder()) .toString(); buf.append(plainTypeVariables).append("\n"); buf.append(annotatedTypeVariables).append("\n"); boolean annotated = plainTypeVariables.equals(annotatedTypeVariables); return annotated; }
/** * Append type arguments * * @param buf Buffer to append to * @param typeArguments Type arguments * @return <code>true</code> if any nullability information was written * @throws IOException I'm sorry, this usually doesn't happen to me... */ protected boolean appendTypeArguments(StringBuilder buf, TypeList.Generic typeArguments) throws IOException { String plainTypeVariables = this.signatureWriter.appendTypeArguments(typeArguments, new StringBuilder()) .toString(); String annotatedTypeVariables = this.signatureWriter.appendTypeArguments(typeArguments, new StringBuilder()) .toString(); buf.append(plainTypeVariables).append("\n"); buf.append(annotatedTypeVariables).append("\n"); boolean annotated = plainTypeVariables.equals(annotatedTypeVariables); return annotated; }
/** * Append a simple class type * * @param type Type to append * @param output Output to append to * @param <A> Type of output * @return Supplied output to append to */ public <A extends Appendable> A appendSimpleClassTypeSignature(Generic type, A output) { try { output.append(type.asErasure().getSimpleName()); if (type.getSort() == Sort.PARAMETERIZED) { appendTypeArguments(type.getTypeArguments(), output); } return output; } catch (Exception e) { throw new RuntimeException(String.format("Could not write type signature %s", type)); } }
/** * Append a simple class type * * @param type Type to append * @param output Output to append to * @param <A> Type of output * @return Supplied output to append to */ public <A extends Appendable> A appendSimpleClassTypeSignature(Generic type, A output) { try { output.append(type.asErasure().getSimpleName()); if (type.getSort() == Sort.PARAMETERIZED) { appendTypeArguments(type.getTypeArguments(), output); } return output; } catch (Exception e) { throw new RuntimeException(String.format("Could not write type signature %s", type)); } }