1 33 34 package net.percederberg.grammatica.code.java; 35 36 import java.io.PrintWriter ; 37 38 import net.percederberg.grammatica.code.CodeStyle; 39 40 46 public class JavaClass extends JavaType { 47 48 51 public static final int PUBLIC = JavaModifier.PUBLIC; 52 53 57 public static final int PROTECTED = JavaModifier.PROTECTED; 58 59 62 public static final int PACKAGE_LOCAL = JavaModifier.PACKAGE_LOCAL; 63 64 68 public static final int PRIVATE = JavaModifier.PRIVATE; 69 70 74 public static final int STATIC = JavaModifier.STATIC; 75 76 79 public static final int ABSTRACT = JavaModifier.ABSTRACT; 80 81 84 public static final int FINAL = JavaModifier.FINAL; 85 86 89 public static final int STRICTFP = JavaModifier.STRICTFP; 90 91 97 public JavaClass(String name) { 98 this(PUBLIC, name); 99 } 100 101 108 public JavaClass(int modifiers, String name) { 109 this(modifiers, name, ""); 110 } 111 112 120 public JavaClass(int modifiers, String name, String extendClass) { 121 this(modifiers, name, extendClass, ""); 122 } 123 124 134 public JavaClass(int modifiers, 135 String name, 136 String extendClass, 137 String implementClass) { 138 139 super(modifiers, name, extendClass, implementClass); 140 } 141 142 152 public JavaClass(int modifiers, 153 String name, 154 String extendClass, 155 String [] implementClasses) { 156 157 super(modifiers, name, extendClass, implementClasses); 158 } 159 160 165 public void addClass(JavaClass member) { 166 addElement(member); 167 } 168 169 174 public void addConstructor(JavaConstructor member) { 175 member.setJavaClass(this); 176 addElement(member); 177 } 178 179 184 public void addMethod(JavaMethod member) { 185 addElement(member); 186 } 187 188 193 public void addVariable(JavaVariable member) { 194 addElement(member); 195 } 196 197 205 public int category() { 206 return 9; 207 } 208 209 216 public void print(PrintWriter out, CodeStyle style, int indent) { 217 print(out, style, indent, "class"); 218 } 219 } 220 | Popular Tags |