Package proguard.classfile.util
Class AccessUtil
- java.lang.Object
-
- proguard.classfile.util.AccessUtil
-
public class AccessUtil extends java.lang.Object
Utility methods for working with access flags. For convenience, this class defines access levels, in ascending order:PRIVATE
,PACKAGE_VISIBLE
,PROTECTED
, andPUBLIC
.
-
-
Field Summary
Fields Modifier and Type Field Description static int
PACKAGE_VISIBLE
static int
PRIVATE
static int
PROTECTED
static int
PUBLIC
-
Constructor Summary
Constructors Constructor Description AccessUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
accepted(int accessFlags, int requiredSetAccessFlags, int requiredUnsetAccessFlags)
Returns whether the given access flags match the required set and unset access flags.static int
accessFlags(int accessLevel)
Returns the corresponding access flags of the given access level.static int
accessLevel(int accessFlags)
Returns the corresponding access level of the given access flags.static int
replaceAccessFlags(int accessFlags, int newAccessFlags)
Replaces the access part of the given access flags.
-
-
-
Field Detail
-
PRIVATE
public static final int PRIVATE
- See Also:
- Constant Field Values
-
PACKAGE_VISIBLE
public static final int PACKAGE_VISIBLE
- See Also:
- Constant Field Values
-
PROTECTED
public static final int PROTECTED
- See Also:
- Constant Field Values
-
PUBLIC
public static final int PUBLIC
- See Also:
- Constant Field Values
-
-
Method Detail
-
accessLevel
public static int accessLevel(int accessFlags)
Returns the corresponding access level of the given access flags.- Parameters:
accessFlags
- the internal access flags as a logical bit mask ofAccessConstants.PRIVATE
,AccessConstants.PROTECTED
, andAccessConstants.PUBLIC
.- Returns:
- the corresponding access level:
PRIVATE
,PACKAGE_VISIBLE
,PROTECTED
, orPUBLIC
.
-
accessFlags
public static int accessFlags(int accessLevel)
Returns the corresponding access flags of the given access level.- Parameters:
accessLevel
- the access level:PRIVATE
,PACKAGE_VISIBLE
,PROTECTED
, orPUBLIC
.- Returns:
- the corresponding internal access flags as a logical bit mask of
AccessConstants.PRIVATE
,AccessConstants.PROTECTED
, andAccessConstants.PUBLIC
.
-
replaceAccessFlags
public static int replaceAccessFlags(int accessFlags, int newAccessFlags)
Replaces the access part of the given access flags.- Parameters:
accessFlags
- the internal access flags as a logical bit mask ofAccessConstants.PRIVATE
,AccessConstants.PROTECTED
, andAccessConstants.PUBLIC
.newAccessFlags
- the new access flags as a logical bit mask ofAccessConstants.PRIVATE
,AccessConstants.PROTECTED
, andAccessConstants.PUBLIC
.- Returns:
- the modified access flags.
-
accepted
public static boolean accepted(int accessFlags, int requiredSetAccessFlags, int requiredUnsetAccessFlags)
Returns whether the given access flags match the required set and unset access flags.- Parameters:
accessFlags
- the internal access flags as a logical bit mask ofAccessConstants.PRIVATE
,AccessConstants.PROTECTED
, andAccessConstants.PUBLIC
.requiredSetAccessFlags
- the internal access flags that should be set, as a logical bit mask ofAccessConstants.PRIVATE
,AccessConstants.PROTECTED
, andAccessConstants.PUBLIC
.requiredUnsetAccessFlags
- the internal access flags that should be unset, as a logical bit mask ofAccessConstants.PRIVATE
,AccessConstants.PROTECTED
, andAccessConstants.PUBLIC
.- Returns:
- whether the access flags match the requirements.
-
-