@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 nulltrue if the class is publicModifier.isPublic(int)public static boolean isPublic(Member member)
public.member - the member to check; never nulltrue if the member is publicModifier.isPublic(int)public static boolean isPrivate(Class<?> clazz)
private.clazz - the class to check; never nulltrue if the class is privateModifier.isPrivate(int)public static boolean isPrivate(Member member)
private.member - the member to check; never nulltrue if the member is privateModifier.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 nulltrue if the class is not privateModifier.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 nulltrue if the member is not privateModifier.isPublic(int),
Modifier.isProtected(int),
Modifier.isPrivate(int)public static boolean isAbstract(Class<?> clazz)
abstract.clazz - the class to check; never nulltrue if the class is abstractModifier.isAbstract(int)public static boolean isAbstract(Member member)
abstract.member - the class to check; never nulltrue if the member is abstractModifier.isAbstract(int)public static boolean isStatic(Class<?> clazz)
static.clazz - the class to check; never nulltrue if the class is staticModifier.isStatic(int)public static boolean isStatic(Member member)
static.member - the member to check; never nulltrue if the member is staticModifier.isStatic(int)public static boolean isNotStatic(Class<?> clazz)
static.clazz - the class to check; never nulltrue if the class is not staticModifier.isStatic(int)public static boolean isNotStatic(Member member)
static.member - the member to check; never nulltrue if the member is not staticModifier.isStatic(int)Copyright © 2024. All rights reserved.