1 23 24 package org.enhydra.xml.xmlc.codegen; 25 26 import java.io.PrintWriter ; 27 28 32 abstract public class JavaVariable { 33 34 protected String fName; 35 protected String fType; 36 protected int fModifiers; 37 protected String [] fDoc; 38 39 48 public JavaVariable(String name, 49 String type, 50 int modifiers, 51 String [] doc) { 52 fName = name; 53 fType = type; 54 fModifiers = modifiers; 55 if ((doc != null) && (doc.length > 0)) { 56 fDoc = (String [])doc.clone(); 57 } 58 } 59 60 69 public JavaVariable(String name, 70 String type, 71 int modifiers, 72 String doc) { 73 this(name, type, modifiers, 74 (doc == null) ? null : new String [] {doc}); 75 } 76 77 80 public String getName() { 81 return fName; 82 } 83 84 87 public String getType() { 88 return fType; 89 } 90 91 94 public int getModifiers() { 95 return fModifiers; 96 } 97 98 101 protected String [] getDoc() { 102 return fDoc; 103 } 104 105 108 public void printDefinition(PrintWriter out) { 109 out.print(JavaModifiers.toDecl(fModifiers)); 110 out.print(fType); 111 out.print(' '); 112 out.print(fName); 113 } 114 } 115 | Popular Tags |