Top Description Constructors Methods
org.junit.platform.commons.support

public final Class ModifierSupport

extends Object
Class Inheritance
Annotations
@API
status:MAINTAINED
since:1.4
Static Imports
org.apiguardian.api.API.Status.MAINTAINED

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.

Since
1.4
See Also
java.lang.reflect.Modifier, AnnotationSupport, ClassSupport, ReflectionSupport

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true if the class is abstract
isAbstract
(Class<?>
the class to check; never null
clazz
)

Determine if the supplied class is abstract.

public static boolean

Returns:

true if the member is abstract
isAbstract
(Member
the class to check; never null
member
)

Determine if the supplied member is abstract.

public static boolean

Returns:

true if the class is final
isFinal
(Class<?>
the class to check; never null
clazz
)

Determine if the supplied class is final.

public static boolean

Returns:

true if the member is final
isFinal
(Member
the member to check; never null
member
)

Determine if the supplied member is final.

public static boolean

Returns:

true if the class is not final
isNotFinal
(Class<?>
the class to check; never null
clazz
)

Determine if the supplied class is not final.

public static boolean

Returns:

true if the member is not final
isNotFinal
(Member
the member to check; never null
member
)

Determine if the supplied member is not final.

public static boolean

Returns:

true if the class is not private
isNotPrivate
(Class<?>
the class to check; never null
clazz
)

Determine if the supplied class is not private.

public static boolean

Returns:

true if the member is not private
isNotPrivate
(Member
the member to check; never null
member
)

Determine if the supplied member is not private.

public static boolean

Returns:

true if the class is not static
isNotStatic
(Class<?>
the class to check; never null
clazz
)

Determine if the supplied class is not static.

public static boolean

Returns:

true if the member is not static
isNotStatic
(Member
the member to check; never null
member
)

Determine if the supplied member is not static.

public static boolean

Returns:

true if the class is private
isPrivate
(Class<?>
the class to check; never null
clazz
)

Determine if the supplied class is private.

public static boolean

Returns:

true if the member is private
isPrivate
(Member
the member to check; never null
member
)

Determine if the supplied member is private.

public static boolean

Returns:

true if the class is public
isPublic
(Class<?>
the class to check; never null
clazz
)

Determine if the supplied class is public.

public static boolean

Returns:

true if the member is public
isPublic
(Member
the member to check; never null
member
)

Determine if the supplied member is public.

public static boolean

Returns:

true if the class is static
isStatic
(Class<?>
the class to check; never null
clazz
)

Determine if the supplied class is static.

public static boolean

Returns:

true if the member is static
isStatic
(Member
the member to check; never null
member
)

Determine if the supplied member is static.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ModifierSupportback to summary
private ModifierSupport()

Method Detail

isAbstractback to summary
public static boolean isAbstract(Class<?> clazz)

Determine if the supplied class is abstract.

Parameters
clazz:Class<?>

the class to check; never null

Returns:boolean

true if the class is abstract

See Also
java.lang.reflect.Modifier#isAbstract(int)
isAbstractback to summary
public static boolean isAbstract(Member member)

Determine if the supplied member is abstract.

Parameters
member:Member

the class to check; never null

Returns:boolean

true if the member is abstract

See Also
java.lang.reflect.Modifier#isAbstract(int)
isFinalback to summary
public static boolean isFinal(Class<?> clazz)

Determine if the supplied class is final.

Parameters
clazz:Class<?>

the class to check; never null

Returns:boolean

true if the class is final

Annotations
@API
status:MAINTAINED
since:1.5
Since
1.5
See Also
java.lang.reflect.Modifier#isFinal(int)
isFinalback to summary
public static boolean isFinal(Member member)

Determine if the supplied member is final.

Parameters
member:Member

the member to check; never null

Returns:boolean

true if the member is final

Annotations
@API
status:MAINTAINED
since:1.5
Since
1.5
See Also
java.lang.reflect.Modifier#isFinal(int)
isNotFinalback to summary
public static boolean isNotFinal(Class<?> clazz)

Determine if the supplied class is not final.

Parameters
clazz:Class<?>

the class to check; never null

Returns:boolean

true if the class is not final

Annotations
@API
status:MAINTAINED
since:1.5
Since
1.5
See Also
java.lang.reflect.Modifier#isFinal(int)
isNotFinalback to summary
public static boolean isNotFinal(Member member)

Determine if the supplied member is not final.

Parameters
member:Member

the member to check; never null

Returns:boolean

true if the member is not final

Annotations
@API
status:MAINTAINED
since:1.5
Since
1.5
See Also
java.lang.reflect.Modifier#isFinal(int)
isNotPrivateback to summary
public static boolean isNotPrivate(Class<?> clazz)

Determine if the supplied class is not 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.

Parameters
clazz:Class<?>

the class to check; never null

Returns:boolean

true if the class is not private

See Also
java.lang.reflect.Modifier#isPublic(int), java.lang.reflect.Modifier#isProtected(int), java.lang.reflect.Modifier#isPrivate(int)
isNotPrivateback to summary
public static boolean isNotPrivate(Member member)

Determine if the supplied member is not 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.

Parameters
member:Member

the member to check; never null

Returns:boolean

true if the member is not private

See Also
java.lang.reflect.Modifier#isPublic(int), java.lang.reflect.Modifier#isProtected(int), java.lang.reflect.Modifier#isPrivate(int)
isNotStaticback to summary
public static boolean isNotStatic(Class<?> clazz)

Determine if the supplied class is not static.

Parameters
clazz:Class<?>

the class to check; never null

Returns:boolean

true if the class is not static

See Also
java.lang.reflect.Modifier#isStatic(int)
isNotStaticback to summary
public static boolean isNotStatic(Member member)

Determine if the supplied member is not static.

Parameters
member:Member

the member to check; never null

Returns:boolean

true if the member is not static

See Also
java.lang.reflect.Modifier#isStatic(int)
isPrivateback to summary
public static boolean isPrivate(Class<?> clazz)

Determine if the supplied class is private.

Parameters
clazz:Class<?>

the class to check; never null

Returns:boolean

true if the class is private

See Also
java.lang.reflect.Modifier#isPrivate(int)
isPrivateback to summary
public static boolean isPrivate(Member member)

Determine if the supplied member is private.

Parameters
member:Member

the member to check; never null

Returns:boolean

true if the member is private

See Also
java.lang.reflect.Modifier#isPrivate(int)
isPublicback to summary
public static boolean isPublic(Class<?> clazz)

Determine if the supplied class is public.

Parameters
clazz:Class<?>

the class to check; never null

Returns:boolean

true if the class is public

See Also
java.lang.reflect.Modifier#isPublic(int)
isPublicback to summary
public static boolean isPublic(Member member)

Determine if the supplied member is public.

Parameters
member:Member

the member to check; never null

Returns:boolean

true if the member is public

See Also
java.lang.reflect.Modifier#isPublic(int)
isStaticback to summary
public static boolean isStatic(Class<?> clazz)

Determine if the supplied class is static.

Parameters
clazz:Class<?>

the class to check; never null

Returns:boolean

true if the class is static

See Also
java.lang.reflect.Modifier#isStatic(int)
isStaticback to summary
public static boolean isStatic(Member member)

Determine if the supplied member is static.

Parameters
member:Member

the member to check; never null

Returns:boolean

true if the member is static

See Also
java.lang.reflect.Modifier#isStatic(int)