public class Flags
extends java.lang.Object
implements java.io.Serializable
Flags
is an immutable set of class, method, or field modifiers.
We represent package scope as the absence of private, public and protected
scope modifiers.Modifier and Type | Class and Description |
---|---|
protected static class |
Flags.FlagComparator |
Modifier and Type | Field and Description |
---|---|
static Flags |
ABSTRACT |
protected static Flags |
ACCESS_FLAGS
All access flags.
|
static Flags |
FINAL |
protected java.util.Set<java.lang.String> |
flags |
static Flags |
INTERFACE |
static Flags |
NATIVE |
static Flags |
NONE |
static Flags |
PRIVATE |
static Flags |
PROTECTED |
static Flags |
PUBLIC |
static Flags |
STATIC |
static Flags |
STRICTFP |
static Flags |
SYNCHRONIZED |
static Flags |
TRANSIENT |
static Flags |
VOLATILE |
Modifier | Constructor and Description |
---|---|
protected |
Flags()
Effects: returns a new access flags object with no access flags set.
|
protected |
Flags(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
Flags |
Abstract()
Return a copy of this
this with the abstract
flag set. |
static void |
addToOrder(java.lang.String name,
Flags after) |
Flags |
clear(Flags other)
Create new flags with the flags in
other cleared. |
Flags |
clearAbstract()
Return a copy of this
this with the abstract
flag clear. |
Flags |
clearFinal()
Return a copy of this
this with the final
flag clear. |
Flags |
clearInterface()
Return a copy of this
this with the interface
flag clear. |
Flags |
clearNative()
Return a copy of this
this with the native
flag clear. |
Flags |
clearPrivate()
Return a copy of this
this with the private
flag clear. |
Flags |
clearProtected()
Return a copy of this
this with the protected
flag clear. |
Flags |
clearPublic()
Return a copy of this
this with the public
flag clear. |
Flags |
clearStatic()
Return a copy of this
this with the static
flag clear. |
Flags |
clearStrictFP()
Return a copy of this
this with the strictfp
flag clear. |
Flags |
clearSynchronized()
Return a copy of this
this with the
synchronized flag clear. |
Flags |
clearTransient()
Return a copy of this
this with the transient
flag clear. |
Flags |
clearVolatile()
Return a copy of this
this with the volatile
flag clear. |
boolean |
contains(Flags other)
Check if all flags in
other are set. |
static Flags |
createFlag(java.lang.String name,
Flags after)
Return a new Flags object with a new name.
|
boolean |
equals(java.lang.Object o) |
Flags |
Final()
Return a copy of this
this with the final
flag set. |
java.util.Set<java.lang.String> |
flags() |
int |
hashCode() |
Flags |
Interface()
Return a copy of this
this with the interface
flag set. |
boolean |
intersects(Flags other)
Check if any flags in
other are set. |
boolean |
isAbstract()
Return true if
this has the abstract flag set. |
boolean |
isFinal()
Return true if
this has the final flag set. |
boolean |
isInterface()
Return true if
this has the interface flag set. |
boolean |
isNative()
Return true if
this has the native flag set. |
boolean |
isPackage()
Return true if
this has the no access flags
(public , private , protected ) set. |
boolean |
isPrivate()
Return true if
this has the private flag set. |
boolean |
isProtected()
Return true if
this has the protected flag set. |
boolean |
isPublic()
Return true if
this has the public flag set. |
boolean |
isStatic()
Return true if
this has the static flag set. |
boolean |
isStrictFP()
Return true if
this has the strictfp flag set. |
boolean |
isSynchronized()
Return true if
this has the synchronized flag
set. |
boolean |
isTransient()
Return true if
this has the transient flag set. |
boolean |
isVolatile()
Return true if
this has the volatile flag set. |
boolean |
moreRestrictiveThan(Flags f)
Return true if
this has more restrictive access flags than
f . |
Flags |
Native()
Return a copy of this
this with the native
flag set. |
Flags |
Package()
Return a copy of this
this with no access flags
(public , private , protected ) set. |
Flags |
Private()
Return a copy of this
this with the private
flag set. |
Flags |
Protected()
Return a copy of this
this with the protected
flag set. |
Flags |
Public()
Return a copy of this
this with the public
flag set. |
Flags |
retain(Flags other)
Create new flags with only flags in
other set. |
Flags |
set(Flags other)
Create new flags with the flags in
other also set. |
Flags |
Static()
Return a copy of this
this with the static
flag set. |
Flags |
StrictFP()
Return a copy of this
this with the strictfp
flag set. |
Flags |
Synchronized()
Return a copy of this
this with the
synchronized flag set. |
java.lang.String |
toString() |
Flags |
Transient()
Return a copy of this
this with the transient
flag set. |
java.lang.String |
translate()
Return "" if no flags set, or toString() + " " if some flags are set.
|
Flags |
Volatile()
Return a copy of this
this with the volatile
flag set. |
protected java.util.Set<java.lang.String> flags
public static final Flags NONE
public static final Flags PUBLIC
public static final Flags PROTECTED
public static final Flags PRIVATE
public static final Flags ABSTRACT
public static final Flags STATIC
public static final Flags FINAL
public static final Flags SYNCHRONIZED
public static final Flags NATIVE
public static final Flags STRICTFP
public static final Flags TRANSIENT
public static final Flags VOLATILE
public static final Flags INTERFACE
protected static final Flags ACCESS_FLAGS
protected Flags()
protected Flags(java.lang.String name)
public static Flags createFlag(java.lang.String name, Flags after)
name
- the name of the new flagafter
- the flags after which this flag should be printed;
Flags.NONE to print before all other flags, null
if we should print at the end.public static void addToOrder(java.lang.String name, Flags after)
public java.util.Set<java.lang.String> flags()
public boolean intersects(Flags other)
other
are set.public boolean contains(Flags other)
other
are set.public Flags Public()
this
with the public
flag set.public Flags clearPublic()
this
with the public
flag clear.public boolean isPublic()
this
has the public
flag set.public Flags Private()
this
with the private
flag set.public Flags clearPrivate()
this
with the private
flag clear.public boolean isPrivate()
this
has the private
flag set.public Flags Protected()
this
with the protected
flag set.public Flags clearProtected()
this
with the protected
flag clear.public boolean isProtected()
this
has the protected
flag set.public Flags Package()
this
with no access flags
(public
, private
, protected
) set.public boolean isPackage()
this
has the no access flags
(public
, private
, protected
) set.public Flags Static()
this
with the static
flag set.public Flags clearStatic()
this
with the static
flag clear.public boolean isStatic()
this
has the static
flag set.public Flags Final()
this
with the final
flag set.public Flags clearFinal()
this
with the final
flag clear.public boolean isFinal()
this
has the final
flag set.public Flags Synchronized()
this
with the
synchronized
flag set.public Flags clearSynchronized()
this
with the
synchronized
flag clear.public boolean isSynchronized()
this
has the synchronized
flag
set.public Flags Transient()
this
with the transient
flag set.public Flags clearTransient()
this
with the transient
flag clear.public boolean isTransient()
this
has the transient
flag set.public Flags Native()
this
with the native
flag set.public Flags clearNative()
this
with the native
flag clear.public boolean isNative()
this
has the native
flag set.public Flags Interface()
this
with the interface
flag set.public Flags clearInterface()
this
with the interface
flag clear.public boolean isInterface()
this
has the interface
flag set.public Flags Abstract()
this
with the abstract
flag set.public Flags clearAbstract()
this
with the abstract
flag clear.public boolean isAbstract()
this
has the abstract
flag set.public Flags Volatile()
this
with the volatile
flag set.public Flags clearVolatile()
this
with the volatile
flag clear.public boolean isVolatile()
this
has the volatile
flag set.public Flags StrictFP()
this
with the strictfp
flag set.public Flags clearStrictFP()
this
with the strictfp
flag clear.public boolean isStrictFP()
this
has the strictfp
flag set.public boolean moreRestrictiveThan(Flags f)
this
has more restrictive access flags than
f
.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String translate()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object