Class ModifierSupport
java.lang.Object
org.junit.platform.commons.support.ModifierSupport
@API(status=MAINTAINED,
since="1.4")
public final class ModifierSupport
extends java.lang.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.
- Since:
- 1.4
- See Also:
Modifier,AnnotationSupport,ClassSupport,ReflectionSupport
-
Method Summary
Modifier and Type Method Description static booleanisAbstract(java.lang.Class<?> clazz)Determine if the supplied class isabstract.static booleanisAbstract(java.lang.reflect.Member member)Determine if the supplied member isabstract.static booleanisFinal(java.lang.Class<?> clazz)Determine if the supplied class isfinal.static booleanisFinal(java.lang.reflect.Member member)Determine if the supplied member isfinal.static booleanisNotFinal(java.lang.Class<?> clazz)Determine if the supplied class is notfinal.static booleanisNotFinal(java.lang.reflect.Member member)Determine if the supplied member is notfinal.static booleanisNotPrivate(java.lang.Class<?> clazz)Determine if the supplied class is notprivate.static booleanisNotPrivate(java.lang.reflect.Member member)Determine if the supplied member is notprivate.static booleanisNotStatic(java.lang.Class<?> clazz)Determine if the supplied class is notstatic.static booleanisNotStatic(java.lang.reflect.Member member)Determine if the supplied member is notstatic.static booleanisPrivate(java.lang.Class<?> clazz)Determine if the supplied class isprivate.static booleanisPrivate(java.lang.reflect.Member member)Determine if the supplied member isprivate.static booleanisPublic(java.lang.Class<?> clazz)Determine if the supplied class ispublic.static booleanisPublic(java.lang.reflect.Member member)Determine if the supplied member ispublic.static booleanisStatic(java.lang.Class<?> clazz)Determine if the supplied class isstatic.static booleanisStatic(java.lang.reflect.Member member)Determine if the supplied member isstatic.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
isPublic
public static boolean isPublic(java.lang.Class<?> clazz)Determine if the supplied class ispublic.- Parameters:
clazz- the class to check; nevernull- Returns:
trueif the class ispublic- See Also:
Modifier.isPublic(int)
-
isPublic
public static boolean isPublic(java.lang.reflect.Member member)Determine if the supplied member ispublic.- Parameters:
member- the member to check; nevernull- Returns:
trueif the member ispublic- See Also:
Modifier.isPublic(int)
-
isPrivate
public static boolean isPrivate(java.lang.Class<?> clazz)Determine if the supplied class isprivate.- Parameters:
clazz- the class to check; nevernull- Returns:
trueif the class isprivate- See Also:
Modifier.isPrivate(int)
-
isPrivate
public static boolean isPrivate(java.lang.reflect.Member member)Determine if the supplied member isprivate.- Parameters:
member- the member to check; nevernull- Returns:
trueif the member isprivate- See Also:
Modifier.isPrivate(int)
-
isNotPrivate
public static boolean isNotPrivate(java.lang.Class<?> clazz)Determine if the supplied class is notprivate.In other words this method will return
truefor classes declared aspublic,protected, or package private andfalsefor classes declared asprivate.- Parameters:
clazz- the class to check; nevernull- Returns:
trueif the class is notprivate- See Also:
Modifier.isPublic(int),Modifier.isProtected(int),Modifier.isPrivate(int)
-
isNotPrivate
public static boolean isNotPrivate(java.lang.reflect.Member member)Determine if the supplied member is notprivate.In other words this method will return
truefor members declared aspublic,protected, or package private andfalsefor members declared asprivate.- Parameters:
member- the member to check; nevernull- Returns:
trueif the member is notprivate- See Also:
Modifier.isPublic(int),Modifier.isProtected(int),Modifier.isPrivate(int)
-
isAbstract
public static boolean isAbstract(java.lang.Class<?> clazz)Determine if the supplied class isabstract.- Parameters:
clazz- the class to check; nevernull- Returns:
trueif the class isabstract- See Also:
Modifier.isAbstract(int)
-
isAbstract
public static boolean isAbstract(java.lang.reflect.Member member)Determine if the supplied member isabstract.- Parameters:
member- the class to check; nevernull- Returns:
trueif the member isabstract- See Also:
Modifier.isAbstract(int)
-
isStatic
public static boolean isStatic(java.lang.Class<?> clazz)Determine if the supplied class isstatic.- Parameters:
clazz- the class to check; nevernull- Returns:
trueif the class isstatic- See Also:
Modifier.isStatic(int)
-
isStatic
public static boolean isStatic(java.lang.reflect.Member member)Determine if the supplied member isstatic.- Parameters:
member- the member to check; nevernull- Returns:
trueif the member isstatic- See Also:
Modifier.isStatic(int)
-
isNotStatic
public static boolean isNotStatic(java.lang.Class<?> clazz)Determine if the supplied class is notstatic.- Parameters:
clazz- the class to check; nevernull- Returns:
trueif the class is notstatic- See Also:
Modifier.isStatic(int)
-
isNotStatic
public static boolean isNotStatic(java.lang.reflect.Member member)Determine if the supplied member is notstatic.- Parameters:
member- the member to check; nevernull- Returns:
trueif the member is notstatic- See Also:
Modifier.isStatic(int)
-
isFinal
@API(status=MAINTAINED, since="1.5") public static boolean isFinal(java.lang.Class<?> clazz)Determine if the supplied class isfinal.- Parameters:
clazz- the class to check; nevernull- Returns:
trueif the class isfinal- Since:
- 1.5
- See Also:
Modifier.isFinal(int)
-
isNotFinal
@API(status=MAINTAINED, since="1.5") public static boolean isNotFinal(java.lang.Class<?> clazz)Determine if the supplied class is notfinal.- Parameters:
clazz- the class to check; nevernull- Returns:
trueif the class is notfinal- Since:
- 1.5
- See Also:
Modifier.isFinal(int)
-
isFinal
@API(status=MAINTAINED, since="1.5") public static boolean isFinal(java.lang.reflect.Member member)Determine if the supplied member isfinal.- Parameters:
member- the member to check; nevernull- Returns:
trueif the member isfinal- Since:
- 1.5
- See Also:
Modifier.isFinal(int)
-
isNotFinal
@API(status=MAINTAINED, since="1.5") public static boolean isNotFinal(java.lang.reflect.Member member)Determine if the supplied member is notfinal.- Parameters:
member- the member to check; nevernull- Returns:
trueif the member is notfinal- Since:
- 1.5
- See Also:
Modifier.isFinal(int)
-