org.apache.commons.clazz
Class ClazzModifiers

java.lang.Object
  extended by org.apache.commons.clazz.ClazzModifiers

public class ClazzModifiers
extends Object

ClazzModifiers defines the modifiers in a manipulable way.

Version:
$Id: ClazzModifiers.java 155436 2005-02-26 13:17:48Z dirkv $
Author:
Stephen Colebourne

Field Summary
static int ABSTRACT
          The int value representing the abstract modifier.
static int FINAL
          The int value representing the final modifier.
static int INTERFACE
          The int value representing the interface modifier.
static int NATIVE
          The int value representing the native modifier.
static int PRIVATE
          The int value representing the private modifier.
static int PROTECTED
          The int value representing the protected modifier.
static int PUBLIC
          The int value representing the public modifier.
static int STATIC
          The int value representing the static modifier.
static int STRICT
          The int value representing the strictfp modifier.
static int SYNCHRONIZED
          The int value representing the synchronized modifier.
static int TRANSIENT
          The int value representing the transient modifier.
static int VOLATILE
          The int value representing the volatile modifier.
 
Constructor Summary
ClazzModifiers(ClazzModifiers modifiers)
          Copy constructor.
ClazzModifiers(int modifiers)
          Constructor.
 
Method Summary
 int getFlags()
          Gets the modifier flags, which can be accessed via java.lang.reflect.
 boolean isAbstract()
          Is the object abstract.
 boolean isFinal()
          Is the object final.
 boolean isNative()
          Is the object native.
 boolean isPackageScope()
          Is the object package scope.
 boolean isPrivateScope()
          Is the object private scope.
 boolean isProtectedScope()
          Is the object protected scope.
 boolean isPublicScope()
          Is the object public scope.
 boolean isStatic()
          Is the object static.
 boolean isStrictFP()
          Is the object strictfp.
 boolean isSynchronized()
          Is the object synchronized.
 boolean isTransient()
          Is the object transient.
 boolean isVolatile()
          Is the object volatile.
 void setAbstract(boolean state)
          Set the object to be abstract.
 void setFinal(boolean state)
          Set the object to be final.
 void setFlags(int modifiers)
          Sets the modifier flags.
 void setNative(boolean state)
          Set the object to be native.
 void setPackageScope()
          Set the object to be package scope.
 void setPrivateScope()
          Set the object to be private scope.
 void setProtectedScope()
          Set the object to be protected scope.
 void setPublicScope()
          Set the object to be public scope.
 void setStatic(boolean state)
          Set the object to be static.
 void setStrictFP(boolean state)
          Set the object to be strictfp.
 void setSynchronized(boolean state)
          Set the object to be synchronized.
 void setTransient(boolean state)
          Set the object to be transient.
 void setVolatile(boolean state)
          Set the object to be volatile.
 String toString()
          Geta string describing the access modifier flags in the specified modifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PUBLIC

public static final int PUBLIC
The int value representing the public modifier.

See Also:
Constant Field Values

PRIVATE

public static final int PRIVATE
The int value representing the private modifier.

See Also:
Constant Field Values

PROTECTED

public static final int PROTECTED
The int value representing the protected modifier.

See Also:
Constant Field Values

STATIC

public static final int STATIC
The int value representing the static modifier.

See Also:
Constant Field Values

FINAL

public static final int FINAL
The int value representing the final modifier.

See Also:
Constant Field Values

SYNCHRONIZED

public static final int SYNCHRONIZED
The int value representing the synchronized modifier.

See Also:
Constant Field Values

VOLATILE

public static final int VOLATILE
The int value representing the volatile modifier.

See Also:
Constant Field Values

TRANSIENT

public static final int TRANSIENT
The int value representing the transient modifier.

See Also:
Constant Field Values

NATIVE

public static final int NATIVE
The int value representing the native modifier.

See Also:
Constant Field Values

INTERFACE

public static final int INTERFACE
The int value representing the interface modifier.

See Also:
Constant Field Values

ABSTRACT

public static final int ABSTRACT
The int value representing the abstract modifier.

See Also:
Constant Field Values

STRICT

public static final int STRICT
The int value representing the strictfp modifier.

See Also:
Constant Field Values
Constructor Detail

ClazzModifiers

public ClazzModifiers(int modifiers)
Constructor.

Parameters:
modifiers - the modifiers

ClazzModifiers

public ClazzModifiers(ClazzModifiers modifiers)
Copy constructor.

Parameters:
modifiers - the modifiers object
Throws:
IllegalArgumentException - if the modifiers object is null
Method Detail

getFlags

public int getFlags()
Gets the modifier flags, which can be accessed via java.lang.reflect. Modifier.

Returns:
the modifier flags

setFlags

public void setFlags(int modifiers)
Sets the modifier flags.

Parameters:
modifiers - the modifier flags to update to

isPublicScope

public boolean isPublicScope()
Is the object public scope.

Returns:
true if public scope

setPublicScope

public void setPublicScope()
Set the object to be public scope.


isProtectedScope

public boolean isProtectedScope()
Is the object protected scope.

Returns:
true if protected scope

setProtectedScope

public void setProtectedScope()
Set the object to be protected scope.


isPackageScope

public boolean isPackageScope()
Is the object package scope.

Returns:
true if package scope

setPackageScope

public void setPackageScope()
Set the object to be package scope.


isPrivateScope

public boolean isPrivateScope()
Is the object private scope.

Returns:
true if private scope

setPrivateScope

public void setPrivateScope()
Set the object to be private scope.


isStatic

public boolean isStatic()
Is the object static.

Returns:
true if static

setStatic

public void setStatic(boolean state)
Set the object to be static.

Parameters:
state - true to make static

isFinal

public boolean isFinal()
Is the object final.

Returns:
true if final

setFinal

public void setFinal(boolean state)
Set the object to be final.

Parameters:
state - true to make final

isSynchronized

public boolean isSynchronized()
Is the object synchronized.

Returns:
true if synchronized

setSynchronized

public void setSynchronized(boolean state)
Set the object to be synchronized.

Parameters:
state - true to make synchronized

isVolatile

public boolean isVolatile()
Is the object volatile.

Returns:
true if volatile

setVolatile

public void setVolatile(boolean state)
Set the object to be volatile.

Parameters:
state - true to make volatile

isTransient

public boolean isTransient()
Is the object transient.

Returns:
true if transient

setTransient

public void setTransient(boolean state)
Set the object to be transient.

Parameters:
state - true to make transient

isNative

public boolean isNative()
Is the object native.

Returns:
true if native

setNative

public void setNative(boolean state)
Set the object to be native.

Parameters:
state - true to make native

isAbstract

public boolean isAbstract()
Is the object abstract.

Returns:
true if abstract

setAbstract

public void setAbstract(boolean state)
Set the object to be abstract.

Parameters:
state - true to make abstract

isStrictFP

public boolean isStrictFP()
Is the object strictfp.

Returns:
true if strictfp

setStrictFP

public void setStrictFP(boolean state)
Set the object to be strictfp.

Parameters:
state - true to make strictfp

toString

public String toString()
Geta string describing the access modifier flags in the specified modifier. For example:
    AModifiers[public final synchronized]
    AModifiers[private transient volatile]
 
The modifier names are return in canonical order, as specified by The Java Language Specification.

Overrides:
toString in class Object
Returns:
a debug string


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.