public String toString() {
   SourcePrinter printer = new SourcePrinter();
   toSource(printer);
   return printer.toString();
 }
  /**
   * toSource
   *
   * @param printer
   */
  public void toSource(SourcePrinter printer) {
    printer.printIndent();

    // print any annotations
    if (!this.isInstanceProperty()) {
      printer.print("static "); // $NON-NLS-1$
    }
    if (this.isInternal()) {
      printer.print("internal "); // $NON-NLS-1$
    }
    if (this.isConstructor()) {
      printer.print("constructor "); // $NON-NLS-1$
    }
    if (this.isMethod()) {
      printer.print("method "); // $NON-NLS-1$
    }

    // print name
    printer.print(this.getName());

    // print parameter types
    printer
        .print('(')
        .print(StringUtil.join(JSTypeConstants.PARAMETER_DELIMITER, this.getParameterTypes()))
        .print(')');

    // print return types
    List<String> returnTypes = this.getReturnTypeNames();

    printer.print(JSTypeConstants.FUNCTION_SIGNATURE_DELIMITER);

    if (!CollectionsUtil.isEmpty(returnTypes)) {
      printer.print(StringUtil.join(JSTypeConstants.RETURN_TYPE_DELIMITER, returnTypes));
    } else {
      printer.print(JSTypeConstants.UNDEFINED_TYPE);
    }

    // print exceptions
    if (this.hasExceptions()) {
      printer
          .print(" throws ")
          .print(StringUtil.join(", ", this.getExceptionTypes())); // $NON-NLS-1$ //$NON-NLS-2$
    }
  }