public class AssertUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
AssertUtils.AnnotationCopy |
| Constructor and Description |
|---|
AssertUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <A extends Annotation> |
annotationProxyOf(Class<A> annotationModelType,
Annotation annotationClone) |
static void |
assertInterface(Class<? extends Object> candidate)
Asserts that the given class is an interface.
|
static void |
assertionIllegalArgument(boolean asserted,
String message)
Asserts that the given parameter is true, otherwise throws an
IllegalArgumentException. |
static void |
assertionNullPointer(boolean asserted,
String message)
Asserts that the given parameter is true, otherwise throws an
NullPointerException. |
static void |
assertIsClass(Class<? extends Object> candidate)
Asserts that the class is not an interface.
|
static void |
assertLegal(Object underAssertion,
String message)
Asserts that the given parameter is not null, otherwise throws an
IllegalArgumentException. |
static void |
assertNotNull(Object underAssertion,
String message)
Asserts that the given parameter is not null, otherwise throws an
NullPointerException. |
static boolean |
hasAnnotationDeep(Class<?> memberDeclaringClass,
Class<? extends Annotation> candidate)
Indicates if a class or at least one of its annotations is annotated by a given annotation.
|
static boolean |
hasAnnotationDeepRegex(Class<?> memberDeclaringClass,
String metaAnnotationRegex)
Indicates if the class name or at least the name of one of its annotations matches the regex.
|
static boolean |
isClass(Class<? extends Object> candidate)
Indicates if the class is not an interface.
|
static boolean |
isEquivalent(Class<? extends Annotation> original,
Class<? extends Annotation> copy) |
static boolean |
isInterface(Class<? extends Object> candidate)
Indicates if the given class is an interface.
|
public static boolean isInterface(Class<? extends Object> candidate)
candidate - the class to checkpublic static void assertInterface(Class<? extends Object> candidate)
candidate - the class to checkIllegalArgumentException - if the assertion is not satisfiedpublic static boolean isClass(Class<? extends Object> candidate)
candidate - the class to checkpublic static void assertIsClass(Class<? extends Object> candidate)
candidate - the class to checkIllegalArgumentException - if the assertion is not satisfiedpublic static boolean hasAnnotationDeep(Class<?> memberDeclaringClass, Class<? extends Annotation> candidate)
Notice that the classes with a package name starting with "java.lang" will be ignored.
memberDeclaringClass - the class to checkcandidate - the annotation to findpublic static boolean hasAnnotationDeepRegex(Class<?> memberDeclaringClass, String metaAnnotationRegex)
Notice that the classes with a package name starting with "java.lang" will be ignored.
memberDeclaringClass - the class to checkmetaAnnotationRegex - the regex to matchpublic static boolean isEquivalent(Class<? extends Annotation> original, Class<? extends Annotation> copy)
public static <A extends Annotation> A annotationProxyOf(Class<A> annotationModelType, Annotation annotationClone)
public static void assertionIllegalArgument(boolean asserted,
String message)
IllegalArgumentException.asserted - the assertion resultmessage - the error messageIllegalArgumentException - if asserted is falsepublic static void assertionNullPointer(boolean asserted,
String message)
NullPointerException.asserted - the assertion resultmessage - the error messageNullPointerException - if asserted is falsepublic static void assertLegal(Object underAssertion, String message)
IllegalArgumentException.underAssertion - the object to checkmessage - the error messageIllegalArgumentException - if asserted is nullpublic static void assertNotNull(Object underAssertion, String message)
NullPointerException.underAssertion - the object to checkmessage - the error messageNullPointerException - if asserted is nullCopyright © 2012-2016. All Rights Reserved.