FileDocCategorySizeDatePackage
Modifier.javaAPI DocAndroid 1.5 API10997Wed May 06 22:41:04 BST 2009java.lang.reflect

Modifier

public class Modifier extends Object
This class provides static methods to decode class and member modifiers.
see
Class#getModifiers()
see
Member#getModifiers()
since
Android 1.0

Fields Summary
public static final int
PUBLIC
The {@code int} value representing the {@code public} modifier.
public static final int
PRIVATE
The {@code int} value representing the {@code private} modifier.
public static final int
PROTECTED
The {@code int} value representing the {@code protected} modifier.
public static final int
STATIC
The {@code int} value representing the {@code static} modifier.
public static final int
FINAL
The {@code int} value representing the {@code final} modifier.
public static final int
SYNCHRONIZED
The {@code int} value representing the {@code synchronized} modifier.
public static final int
VOLATILE
The {@code int} value representing the {@code volatile} modifier.
public static final int
TRANSIENT
The {@code int} value representing the {@code transient} modifier.
public static final int
NATIVE
The {@code int} value representing the {@code native} modifier.
public static final int
INTERFACE
The {@code int} value representing the {@code interface} modifier.
public static final int
ABSTRACT
The {@code int} value representing the {@code abstract} modifier.
public static final int
STRICT
The {@code int} value representing the {@code strict} modifier.
static final int
BRIDGE
static final int
VARARGS
static final int
SYNTHETIC
static final int
ANNOTATION
static final int
ENUM
Constructors Summary
public Modifier()
Constructs a new {@code Modifier} instance.

since
Android 1.0


                  
      
    
Methods Summary
public static booleanisAbstract(int modifiers)
Indicates whether or not the specified modifiers contain the {@code abstract} modifier.

param
modifiers the modifiers to test
return
{@code true} if the specified modifiers contain the {@code abstract} modifier, {@code false} otherwise
since
Android 1.0

        return ((modifiers & ABSTRACT) != 0);
    
public static booleanisFinal(int modifiers)
Indicates whether or not the specified modifiers contain the {@code final} modifier.

param
modifiers the modifiers to test
return
{@code true} if the specified modifiers contain the {@code final} modifier, {@code false} otherwise
since
Android 1.0

        return ((modifiers & FINAL) != 0);
    
public static booleanisInterface(int modifiers)
Indicates whether or not the specified modifiers contain the {@code interface} modifier.

param
modifiers the modifiers to test
return
{@code true} if the specified modifiers contain the {@code interface} modifier, {@code false} otherwise
since
Android 1.0

        return ((modifiers & INTERFACE) != 0);
    
public static booleanisNative(int modifiers)
Indicates whether or not the specified modifiers contain the {@code native} modifier.

param
modifiers the modifiers to test
return
{@code true} if the specified modifiers contain the {@code native} modifier, {@code false} otherwise
since
Android 1.0

        return ((modifiers & NATIVE) != 0);
    
public static booleanisPrivate(int modifiers)
Indicates whether or not the specified modifiers contain the {@code private} modifier.

param
modifiers the modifiers to test
return
{@code true} if the specified modifiers contain the {@code private} modifier, {@code false} otherwise
since
Android 1.0

        return ((modifiers & PRIVATE) != 0);
    
public static booleanisProtected(int modifiers)
Indicates whether or not the specified modifiers contain the {@code protected} modifier.

param
modifiers the modifiers to test
return
{@code true} if the specified modifiers contain the {@code protected} modifier, {@code false} otherwise
since
Android 1.0

        return ((modifiers & PROTECTED) != 0);
    
public static booleanisPublic(int modifiers)
Indicates whether or not the specified modifiers contain the {@code public} modifier.

param
modifiers the modifiers to test
return
{@code true} if the specified modifiers contain the {@code public} modifier, {@code false} otherwise
since
Android 1.0

        return ((modifiers & PUBLIC) != 0);
    
public static booleanisStatic(int modifiers)
Indicates whether or not the specified modifiers contain the {@code static} modifier.

param
modifiers the modifiers to test
return
{@code true} if the specified modifiers contain the {@code static} modifier, {@code false} otherwise
since
Android 1.0

        return ((modifiers & STATIC) != 0);
    
public static booleanisStrict(int modifiers)
Indicates whether or not the specified modifiers contain the {@code strict} modifier.

param
modifiers the modifiers to test
return
{@code true} if the specified modifiers contain the {@code strict} modifier, {@code false} otherwise
since
Android 1.0

        return ((modifiers & STRICT) != 0);
    
public static booleanisSynchronized(int modifiers)
Indicates whether or not the specified modifiers contain the {@code synchronized} modifier.

param
modifiers the modifiers to test
return
{@code true} if the specified modifiers contain the {@code synchronized} modifier, {@code false} otherwise
since
Android 1.0

        return ((modifiers & SYNCHRONIZED) != 0);
    
public static booleanisTransient(int modifiers)
Indicates whether or not the specified modifiers contain the {@code transient} modifier.

param
modifiers the modifiers to test
return
{@code true} if the specified modifiers contain the {@code transient} modifier, {@code false} otherwise
since
Android 1.0

        return ((modifiers & TRANSIENT) != 0);
    
public static booleanisVolatile(int modifiers)
Indicates whether or not the specified modifiers contain the {@code volatile} modifier.

param
modifiers the modifiers to test
return
{@code true} if the specified modifiers contain the {@code volatile} modifier, {@code false} otherwise
since
Android 1.0

        return ((modifiers & VOLATILE) != 0);
    
public static java.lang.StringtoString(int modifiers)
Returns a string containing the string representation of all modifiers present in the specified modifiers. Modifiers appear in the order specified by the Java Language Specification: {@code public private protected abstract static final transient volatile native synchronized interface strict}

param
modifiers the modifiers to print
return
a printable representation of the modifiers
since
Android 1.0

        StringBuffer buf;

        buf = new StringBuffer();

        if (isPublic(modifiers)) {
            buf.append("public ");
        }
        if (isProtected(modifiers)) {
            buf.append("protected ");
        }
        if (isPrivate(modifiers)) {
            buf.append("private ");
        }
        if (isAbstract(modifiers)) {
            buf.append("abstract ");
        }
        if (isStatic(modifiers)) {
            buf.append("static ");
        }
        if (isFinal(modifiers)) {
            buf.append("final ");
        }
        if (isTransient(modifiers)) {
            buf.append("transient ");
        }
        if (isVolatile(modifiers)) {
            buf.append("volatile ");
        }
        if (isSynchronized(modifiers)) {
            buf.append("synchronized ");
        }
        if (isNative(modifiers)) {
            buf.append("native ");
        }
        if (isStrict(modifiers)) {
            buf.append("strictfp ");
        }
        if (isInterface(modifiers)) {
            buf.append("interface ");
        }
        if (buf.length() == 0) {
            return "";
        }
        buf.setLength(buf.length() - 1);
        return buf.toString();