@API(status=MAINTAINED, since="1.4") public final class ModifierSupport extends Object
ModifierSupport
provides static utility methods for working with
class and member modifiers —
for example, to determine if a class or member is declared as
public
, private
, abstract
, static
, etc.
TestEngine
and extension
authors are encouraged to use these supported methods in order to align with
the behavior of the JUnit Platform.
Modifier
,
AnnotationSupport
,
ClassSupport
,
ReflectionSupport
Modifier and Type | Method and Description |
---|---|
static boolean |
isAbstract(Class<?> clazz)
Determine if the supplied class is
abstract . |
static boolean |
isAbstract(Member member)
Determine if the supplied member is
abstract . |
static boolean |
isNotPrivate(Class<?> clazz)
Determine if the supplied class is not
private . |
static boolean |
isNotPrivate(Member member)
Determine if the supplied member is not
private . |
static boolean |
isNotStatic(Class<?> clazz)
Determine if the supplied class is not
static . |
static boolean |
isNotStatic(Member member)
Determine if the supplied member is not
static . |
static boolean |
isPrivate(Class<?> clazz)
Determine if the supplied class is
private . |
static boolean |
isPrivate(Member member)
Determine if the supplied member is
private . |
static boolean |
isPublic(Class<?> clazz)
Determine if the supplied class is
public . |
static boolean |
isPublic(Member member)
Determine if the supplied member is
public . |
static boolean |
isStatic(Class<?> clazz)
Determine if the supplied class is
static . |
static boolean |
isStatic(Member member)
Determine if the supplied member is
static . |
public static boolean isPublic(Class<?> clazz)
public
.clazz
- the class to check; never null
true
if the class is public
Modifier.isPublic(int)
public static boolean isPublic(Member member)
public
.member
- the member to check; never null
true
if the member is public
Modifier.isPublic(int)
public static boolean isPrivate(Class<?> clazz)
private
.clazz
- the class to check; never null
true
if the class is private
Modifier.isPrivate(int)
public static boolean isPrivate(Member member)
private
.member
- the member to check; never null
true
if the member is private
Modifier.isPrivate(int)
public static boolean isNotPrivate(Class<?> clazz)
private
.
In other words this method will return true
for classes
declared as public
, protected
, or
package private and false
for classes declared as
private
.
clazz
- the class to check; never null
true
if the class is not private
Modifier.isPublic(int)
,
Modifier.isProtected(int)
,
Modifier.isPrivate(int)
public static boolean isNotPrivate(Member member)
private
.
In other words this method will return true
for members
declared as public
, protected
, or
package private and false
for members declared as
private
.
member
- the member to check; never null
true
if the member is not private
Modifier.isPublic(int)
,
Modifier.isProtected(int)
,
Modifier.isPrivate(int)
public static boolean isAbstract(Class<?> clazz)
abstract
.clazz
- the class to check; never null
true
if the class is abstract
Modifier.isAbstract(int)
public static boolean isAbstract(Member member)
abstract
.member
- the class to check; never null
true
if the member is abstract
Modifier.isAbstract(int)
public static boolean isStatic(Class<?> clazz)
static
.clazz
- the class to check; never null
true
if the class is static
Modifier.isStatic(int)
public static boolean isStatic(Member member)
static
.member
- the member to check; never null
true
if the member is static
Modifier.isStatic(int)
public static boolean isNotStatic(Class<?> clazz)
static
.clazz
- the class to check; never null
true
if the class is not static
Modifier.isStatic(int)
public static boolean isNotStatic(Member member)
static
.member
- the member to check; never null
true
if the member is not static
Modifier.isStatic(int)
Copyright © 2023. All rights reserved.