AccessSourcerpublic class AccessSourcer extends Object Source generator for the access fields of methods, fields and classes.
Given an integer access field and a type ({@link #IS_CLASS}, {@link #IS_FIELD} or
{@link #IS_METHOD}), the {@link #write(int, int)} method can generate a string
desribing the access modifiers for a Java source. |
Fields Summary |
---|
private final Output | mOutput | public static int | IS_CLASS | public static int | IS_FIELD | public static int | IS_METHOD |
Constructors Summary |
---|
public AccessSourcer(Output output)
mOutput = output;
|
Methods Summary |
---|
public void | write(int access, int filter)Generates a list of access keywords, e.g. "public final".
It is up to the caller to filter extra keywords that should not be generated,
e.g. {@link Flag#ACC_SYNTHETIC}.
boolean need_sep = false;
for (Flag f : Flag.values()) {
if ((f.getFilter() & filter) != 0 && (access & f.getValue()) != 0) {
if (need_sep) {
mOutput.write(" ");
}
mOutput.write(f.toString());
need_sep = true;
}
}
|
|