Sfoglia il codice sorgente

Added describe method to modifiers

Jared 5 anni fa
parent
commit
f2025c98c7
Nessun account collegato all'indirizzo email del committer

+ 20
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/Modifiers.java Vedi File

@@ -81,4 +81,24 @@ public class Modifiers {
81 81
 	public static boolean hasAccess(int modifiers) {
82 82
 		return (modifiers & (PRIVATE | PUBLIC | PROTECTED | INTERNAL)) > 0;
83 83
 	}
84
+    
85
+    public static String describe(int modifiers) {
86
+        StringBuilder builder = new StringBuilder();
87
+        if (isPublic(modifiers)) {
88
+            builder.append("public");
89
+        } else if (isPrivate(modifiers)) {
90
+            builder.append("private");
91
+        } else if (isProtected(modifiers)) {
92
+            builder.append("protected");
93
+        }
94
+        if (isAbstract(modifiers)) {
95
+            builder.append(" abstract");
96
+        } else if (isFinal(modifiers)) {
97
+            builder.append(" final");
98
+        } else if (isStatic(modifiers)) {
99
+            builder.append(" static");
100
+        }
101
+        return builder.toString();
102
+    }
103
+    
84 104
 }

Loading…
Annulla
Salva