Browse Source

Added describe method to modifiers

Jared 5 years ago
parent
commit
f2025c98c7
No account linked to committer's email address

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

81
 	public static boolean hasAccess(int modifiers) {
81
 	public static boolean hasAccess(int modifiers) {
82
 		return (modifiers & (PRIVATE | PUBLIC | PROTECTED | INTERNAL)) > 0;
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…
Cancel
Save