/** * Append a type parameter * * @param typeParameter Type parameters to append * @param output Output to append to * @param <A> Type of output * @return Supplied output to append to */ public <A extends Appendable> A appendTypeParameter(Generic typeParameter, A output) { try { output.append(typeParameter.getSymbol()); TypeList.Generic upperBounds = typeParameter.getUpperBounds(); if (upperBounds.size() == 0) { throw new IllegalArgumentException( String.format("Type parameter '%s' must have upper bounds", typeParameter)); } if (upperBounds.get(0).isInterface()) { output.append(':'); } for (Generic upperBound : upperBounds) { appendClassOrInterfaceBound(upperBound, output); } return output; } catch (Exception e) { throw new RuntimeException(String.format("Could not write type parameter %s", typeParameter)); } }
/** * Append a type parameter * * @param typeParameter Type parameters to append * @param output Output to append to * @param <A> Type of output * @return Supplied output to append to */ public <A extends Appendable> A appendTypeParameter(Generic typeParameter, A output) { try { output.append(typeParameter.getSymbol()); TypeList.Generic upperBounds = typeParameter.getUpperBounds(); if (upperBounds.size() == 0) { throw new IllegalArgumentException( String.format("Type parameter '%s' must have upper bounds", typeParameter)); } if (upperBounds.get(0).isInterface()) { output.append(':'); } for (Generic upperBound : upperBounds) { appendClassOrInterfaceBound(upperBound, output); } return output; } catch (Exception e) { throw new RuntimeException(String.format("Could not write type parameter %s", typeParameter)); } }