View Javadoc
1 /* FOREGEJ - FOrmatting REfactoring GEnerating Java 2 * 3 * Copyright (C) 2003 Andreas Arrgard 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 package com.octagroup.foregej.ant; 20 import antlr.RecognitionException; 21 import antlr.TokenStreamException; 22 import java.io.File; 23 import java.io.IOException; 24 import com.octagroup.foregej.java.lang.ast.CompilationUnit; 25 /*** 26 * This class formats a java file. 27 */ 28 public class JavaFormatter 29 { 30 /*** 31 * Reads the source file and writes the formatted content to the destination file. 32 * 33 * @param dest the java destination 34 * @param src the java source file 35 * @throws IOException from underlying parser 36 * @throws InterruptedException from underlying parser 37 * @throws RecognitionException from underlying parser 38 * @throws TokenStreamException from underlying parser 39 */ 40 public static void format(File src,File dest) throws TokenStreamException, RecognitionException, IOException, InterruptedException 41 { 42 CompilationUnit cu=parseFile(src); 43 cu.write(); 44 } 45 /*** 46 * DOCUMENT ME! 47 * 48 * @param src DOCUMENT ME! 49 * @return DOCUMENT ME! 50 * @throws IOException DOCUMENT ME! 51 * @throws InterruptedException DOCUMENT ME! 52 * @throws RecognitionException DOCUMENT ME! 53 * @throws TokenStreamException DOCUMENT ME! 54 */ 55 public static CompilationUnit parseFile(File src) throws TokenStreamException, RecognitionException, IOException, InterruptedException 56 { 57 CompilationUnit cu=new CompilationUnit(src); 58 cu.read(); 59 return cu; 60 } 61 }

This page was automatically generated by Maven