示例#1
0
 /**
  * Prints the node as a string.
  *
  * @return The printed representation.
  */
 public String build() {
   try {
     return (String) method_build.invoke(codePrinterBuilder);
   } catch (IllegalArgumentException e) {
     throw new MagicException(e);
   } catch (IllegalAccessException e) {
     throw new MagicException(e);
   } catch (InvocationTargetException e) {
     Magic.catchInvocationTargetException(e);
     return null;
   }
 }
示例#2
0
 /**
  * @param node The node to be printed.
  * @param prettyPrint Whether to pretty print.
  * @param outputTypes Whether to output types as JSDocStrings.
  */
 public MagicCodePrinterBuilder(Node node, boolean prettyPrint, boolean outputTypes) {
   initialize();
   try {
     codePrinterBuilder = constructor.newInstance(node);
     field_prettyPrint.setBoolean(codePrinterBuilder, prettyPrint);
     field_outputTypes.setBoolean(codePrinterBuilder, outputTypes);
   } catch (IllegalArgumentException e) {
     throw new MagicException(e);
   } catch (InstantiationException e) {
     throw new MagicException(e);
   } catch (IllegalAccessException e) {
     throw new MagicException(e);
   } catch (InvocationTargetException e) {
     Magic.catchInvocationTargetException(e);
   }
 }