public class AnnotationUtils
extends java.lang.Object
EserialAnnotations.| Modifier and Type | Method and Description |
|---|---|
static int |
compare(java.lang.annotation.Annotation lhs,
java.lang.annotation.Annotation rhs)
Compares to
EserialAnnotations according to their priorities. |
static <T extends java.lang.annotation.Annotation> |
getAnnotation(EserialElement element,
java.lang.Class<T> annotationClass) |
static java.util.List<java.lang.annotation.Annotation> |
getEserialAnnotations(Accessor accessor,
EserialAnnotationType type) |
static java.util.List<java.lang.annotation.Annotation> |
getEserialAnnotations(java.lang.Class clazz,
EserialAnnotationType type) |
static java.util.List<java.lang.annotation.Annotation> |
getEserialAnnotations(java.lang.reflect.Field field,
EserialAnnotationType type) |
static java.util.List<java.lang.annotation.Annotation> |
getEserialAnnotations(java.util.List<java.lang.annotation.Annotation> annotations,
EserialAnnotationType type) |
static <T extends java.lang.annotation.Annotation> |
hasAnnotation(EserialElement element,
java.lang.Class<T> annotationClass) |
static boolean |
isEserialAnnotation(java.lang.annotation.Annotation annotation) |
static boolean |
isMatchingEserialAnnotation(java.lang.annotation.Annotation annotation,
EserialAnnotationType type) |
static boolean |
shouldIncludeElement(EserialElement element)
Decides whether an
element should be included depending on the EserialAnnotations on its
field (if exists), accessor and containing class.The annotations are ordered by their priorities. |
public static java.util.List<java.lang.annotation.Annotation> getEserialAnnotations(java.lang.reflect.Field field,
EserialAnnotationType type)
field - an arbitrary fieldtype - the type of EserialAnnotationEserialAnnotations on the fieldgetEserialAnnotations(List, EserialAnnotationType)public static java.util.List<java.lang.annotation.Annotation> getEserialAnnotations(Accessor accessor, EserialAnnotationType type)
accessor - a Getter or Settertype - the type of EserialAnnotationEserialAnnotations on the accessor methodpublic static java.util.List<java.lang.annotation.Annotation> getEserialAnnotations(java.lang.Class clazz,
EserialAnnotationType type)
clazz - a classtype - the type of EserialAnnotationEserialAnnotations on the clazzgetEserialAnnotations(List,EserialAnnotationType)public static java.util.List<java.lang.annotation.Annotation> getEserialAnnotations(java.util.List<java.lang.annotation.Annotation> annotations,
EserialAnnotationType type)
annotations - a list of annotationstype - the type of EserialAnnotationannotations list's annotations which
have an EserialAnnotation on themisMatchingEserialAnnotation(java.lang.annotation.Annotation, hu.elte.eserial.annotation.enumeration.EserialAnnotationType)public static boolean isEserialAnnotation(java.lang.annotation.Annotation annotation)
annotation - an annotationtrue if the has an EserialAnnotation on itpublic static boolean isMatchingEserialAnnotation(java.lang.annotation.Annotation annotation,
EserialAnnotationType type)
annotation - an annotationtype - the type of EserialAnnotationtrue if the has an EserialAnnotation with the given type on itpublic static int compare(java.lang.annotation.Annotation lhs,
java.lang.annotation.Annotation rhs)
EserialAnnotations according to their priorities.lhs - an EserialAnnotationrhs - an EserialAnnotation0 if lhs.priority() == rhs.priority(),0 if lhs.priority() > rhs.priority() and0 if lhs.priority() < rhs.priority()EserialNotEserialAnnotationException - if lhs or rhs is not an EserialAnnotationInteger.compare(int, int)public static <T extends java.lang.annotation.Annotation> boolean hasAnnotation(EserialElement element, java.lang.Class<T> annotationClass)
T - the type of the annotationelement - an element on which annotations are searchedannotationClass - the class of annotation to findtrue if there is an annotation with the given type for the elementpublic static <T extends java.lang.annotation.Annotation> T getAnnotation(EserialElement element, java.lang.Class<T> annotationClass)
T - the type of the annotation for convenient casting of return valueelement - an element on which annotations are searchedannotationClass - the class of annotation to findnull if none was foundpublic static boolean shouldIncludeElement(EserialElement element)
element should be included depending on the EserialAnnotations on its
field (if exists), accessor and containing class.element - an element containing an accessor and a fieldtrue if the element should be includedEserialAnnotation.priority()