FileDocCategorySizeDatePackage
AccessFlags.javaAPI DocAndroid 5.1 API11458Thu Mar 12 22:18:30 GMT 2015com.android.dexgen.rop.code

AccessFlags

public final class AccessFlags extends Object
Constants used as "access flags" in various places in classes, and related utilities. Although, at the rop layer, flags are generally ignored, this is the layer of communication, and as such, this package is where these definitions belong. The flag definitions are identical to Java access flags, but {@code ACC_SUPER} isn't used at all in translated code, and {@code ACC_SYNCHRONIZED} is only used in a very limited way.

Fields Summary
public static final int
ACC_PUBLIC
public member / class
public static final int
ACC_PRIVATE
private member
public static final int
ACC_PROTECTED
protected member
public static final int
ACC_STATIC
static member
public static final int
ACC_FINAL
final member / class
public static final int
ACC_SYNCHRONIZED
synchronized method; only valid in dex files for {@code native} methods
public static final int
ACC_SUPER
class with new-style {@code invokespecial} for superclass method access
public static final int
ACC_VOLATILE
volatile field
public static final int
ACC_BRIDGE
bridge method (generated)
public static final int
ACC_TRANSIENT
transient field
public static final int
ACC_VARARGS
varargs method
public static final int
ACC_NATIVE
native method
public static final int
ACC_INTERFACE
"class" is in fact an public static final interface
public static final int
ACC_ABSTRACT
abstract method / class
public static final int
ACC_STRICT
method with strict floating point ({@code strictfp}) behavior
public static final int
ACC_SYNTHETIC
synthetic member
public static final int
ACC_ANNOTATION
class is an annotation type
public static final int
ACC_ENUM
class is an enumerated type; field is an element of an enumerated type
public static final int
ACC_CONSTRUCTOR
method is a constructor
public static final int
ACC_DECLARED_SYNCHRONIZED
method was declared {@code synchronized}; has no effect on execution (other than inspecting this flag, per se)
public static final int
CLASS_FLAGS
flags defined on classes
public static final int
INNER_CLASS_FLAGS
flags defined on inner classes
public static final int
FIELD_FLAGS
flags defined on fields
public static final int
METHOD_FLAGS
flags defined on methods
private static final int
CONV_CLASS
indicates conversion of class flags
private static final int
CONV_FIELD
indicates conversion of field flags
private static final int
CONV_METHOD
indicates conversion of method flags
Constructors Summary
private AccessFlags()
This class is uninstantiable.


             
      
        // This space intentionally left blank.
    
Methods Summary
public static java.lang.StringclassString(int flags)
Returns a human-oriented string representing the given access flags, as defined on classes (not fields or methods).

param
flags the flags
return
{@code non-null;} human-oriented string

        return humanHelper(flags, CLASS_FLAGS, CONV_CLASS);
    
public static java.lang.StringfieldString(int flags)
Returns a human-oriented string representing the given access flags, as defined on fields (not classes or methods).

param
flags the flags
return
{@code non-null;} human-oriented string

        return humanHelper(flags, FIELD_FLAGS, CONV_FIELD);
    
private static java.lang.StringhumanHelper(int flags, int mask, int what)
Helper to return a human-oriented string representing the given access flags.

param
flags the defined flags
param
mask mask for the "defined" bits
param
what what the flags represent (one of {@code CONV_*})
return
{@code non-null;} human-oriented string

        StringBuffer sb = new StringBuffer(80);
        int extra = flags & ~mask;

        flags &= mask;

        if ((flags & ACC_PUBLIC) != 0) {
            sb.append("|public");
        }
        if ((flags & ACC_PRIVATE) != 0) {
            sb.append("|private");
        }
        if ((flags & ACC_PROTECTED) != 0) {
            sb.append("|protected");
        }
        if ((flags & ACC_STATIC) != 0) {
            sb.append("|static");
        }
        if ((flags & ACC_FINAL) != 0) {
            sb.append("|final");
        }
        if ((flags & ACC_SYNCHRONIZED) != 0) {
            if (what == CONV_CLASS) {
                sb.append("|super");
            } else {
                sb.append("|synchronized");
            }
        }
        if ((flags & ACC_VOLATILE) != 0) {
            if (what == CONV_METHOD) {
                sb.append("|bridge");
            } else {
                sb.append("|volatile");
            }
        }
        if ((flags & ACC_TRANSIENT) != 0) {
            if (what == CONV_METHOD) {
                sb.append("|varargs");
            } else {
                sb.append("|transient");
            }
        }
        if ((flags & ACC_NATIVE) != 0) {
            sb.append("|native");
        }
        if ((flags & ACC_INTERFACE) != 0) {
            sb.append("|interface");
        }
        if ((flags & ACC_ABSTRACT) != 0) {
            sb.append("|abstract");
        }
        if ((flags & ACC_STRICT) != 0) {
            sb.append("|strictfp");
        }
        if ((flags & ACC_SYNTHETIC) != 0) {
            sb.append("|synthetic");
        }
        if ((flags & ACC_ANNOTATION) != 0) {
            sb.append("|annotation");
        }
        if ((flags & ACC_ENUM) != 0) {
            sb.append("|enum");
        }
        if ((flags & ACC_CONSTRUCTOR) != 0) {
            sb.append("|constructor");
        }
        if ((flags & ACC_DECLARED_SYNCHRONIZED) != 0) {
            sb.append("|declared_synchronized");
        }

        if ((extra != 0) || (sb.length() == 0)) {
            sb.append('|");
            sb.append(Hex.u2(extra));
        }

        return sb.substring(1);
    
public static java.lang.StringinnerClassString(int flags)
Returns a human-oriented string representing the given access flags, as defined on inner classes.

param
flags the flags
return
{@code non-null;} human-oriented string

        return humanHelper(flags, INNER_CLASS_FLAGS, CONV_CLASS);
    
public static booleanisAbstract(int flags)
Returns whether the flag {@code ACC_ABSTRACT} is on in the given flags.

param
flags the flags to check
return
the value of the {@code ACC_ABSTRACT} flag

        return (flags & ACC_ABSTRACT) != 0;
    
public static booleanisAnnotation(int flags)
Returns whether the flag {@code ACC_ANNOTATION} is on in the given flags.

param
flags the flags to check
return
the value of the {@code ACC_ANNOTATION} flag

        return (flags & ACC_ANNOTATION) != 0;
    
public static booleanisDeclaredSynchronized(int flags)
Returns whether the flag {@code ACC_DECLARED_SYNCHRONIZED} is on in the given flags.

param
flags the flags to check
return
the value of the {@code ACC_DECLARED_SYNCHRONIZED} flag

        return (flags & ACC_DECLARED_SYNCHRONIZED) != 0;
    
public static booleanisNative(int flags)
Returns whether the flag {@code ACC_NATIVE} is on in the given flags.

param
flags the flags to check
return
the value of the {@code ACC_NATIVE} flag

        return (flags & ACC_NATIVE) != 0;
    
public static booleanisPrivate(int flags)
Returns whether the flag {@code ACC_PRIVATE} is on in the given flags.

param
flags the flags to check
return
the value of the {@code ACC_PRIVATE} flag

        return (flags & ACC_PRIVATE) != 0;
    
public static booleanisProtected(int flags)
Returns whether the flag {@code ACC_PROTECTED} is on in the given flags.

param
flags the flags to check
return
the value of the {@code ACC_PROTECTED} flag

        return (flags & ACC_PROTECTED) != 0;
    
public static booleanisPublic(int flags)
Returns whether the flag {@code ACC_PUBLIC} is on in the given flags.

param
flags the flags to check
return
the value of the {@code ACC_PUBLIC} flag

        return (flags & ACC_PUBLIC) != 0;
    
public static booleanisStatic(int flags)
Returns whether the flag {@code ACC_STATIC} is on in the given flags.

param
flags the flags to check
return
the value of the {@code ACC_STATIC} flag

        return (flags & ACC_STATIC) != 0;
    
public static booleanisSynchronized(int flags)
Returns whether the flag {@code ACC_SYNCHRONIZED} is on in the given flags.

param
flags the flags to check
return
the value of the {@code ACC_SYNCHRONIZED} flag

        return (flags & ACC_SYNCHRONIZED) != 0;
    
public static java.lang.StringmethodString(int flags)
Returns a human-oriented string representing the given access flags, as defined on methods (not classes or fields).

param
flags the flags
return
{@code non-null;} human-oriented string

        return humanHelper(flags, METHOD_FLAGS, CONV_METHOD);