| 1 | // |
| 2 | // (c) Copyright, Moebius Solutions, 2002 |
| 3 | // |
| 4 | // All Rights Reserved |
| 5 | // |
| 6 | // This material may be reproduced by or for the U. S. Government |
| 7 | // pursuant to the copyright license under the clause at |
| 8 | // DFARS 252.227-7013 (OCT 1988). |
| 9 | // |
| 10 | /* |
| 11 | * $Id: JavaTypePrinter.java,v 1.1.1.5 2004/05/25 20:23:30 hastings Exp $ |
| 12 | */ |
| 13 | package com.moesol.generator.printer; |
| 14 | |
| 15 | import java.io.*; |
| 16 | |
| 17 | /** |
| 18 | * Print types out in a manner suitable for Java programs. |
| 19 | */ |
| 20 | public class JavaTypePrinter extends TypePrinter { |
| 21 | protected JavaTypePrinter() { } |
| 22 | private static JavaTypePrinter instance = new JavaTypePrinter(); |
| 23 | public static JavaTypePrinter getInstance() { |
| 24 | return instance; |
| 25 | } |
| 26 | public void print(Class type, Writer out) throws IOException { |
| 27 | if (type.isArray()) { |
| 28 | print(type.getComponentType(), out); |
| 29 | out.write("[]"); |
| 30 | } else { |
| 31 | out.write(type.getName()); |
| 32 | } |
| 33 | } |
| 34 | } |