1 23 24 package org.enhydra.xml.xmlc.codegen; 25 26 29 public class JavaModifiers { 30 33 public static int PUBLIC = 0x01; 34 35 38 public static int PROTECTED = 0x02; 39 40 43 public static int PRIVATE = 0x04; 44 45 48 public static int STATIC = 0x08; 49 50 53 public static int FINAL = 0x10; 54 55 58 public static int ABSTRACT = 0x20; 59 60 64 public static int OMIT_IMPLEMENTATION = 0x40; 65 66 70 public static int OMIT_INTERFACE = 0x80; 71 72 76 public static int PUBLIC_CONST = PUBLIC | STATIC | FINAL; 77 78 82 public static int PRIVATE_CONST = PRIVATE | STATIC | FINAL; 83 84 87 private JavaModifiers() { 88 } 89 90 94 public static String toDecl(int modifiers) { 95 if (modifiers == 0) { 96 return ""; 98 } 99 100 StringBuffer str = new StringBuffer (); 101 if ((modifiers & PUBLIC) != 0) { 102 str.append("public"); 103 str.append(' '); 104 } 105 if ((modifiers & PROTECTED) != 0) { 106 str.append("protected"); 107 str.append(' '); 108 } 109 if ((modifiers & PRIVATE) != 0) { 110 str.append("private"); 111 str.append(' '); 112 } 113 if ((modifiers & STATIC) != 0) { 114 str.append("static"); 115 str.append(' '); 116 } 117 if ((modifiers & FINAL) != 0) { 118 str.append("final"); 119 str.append(' '); 120 } 121 if ((modifiers & ABSTRACT) != 0) { 122 str.append("abstract"); 123 str.append(' '); 124 } 125 return str.toString(); 126 } 127 } 128 129 | Popular Tags |