nl.jqno.equalsverifier.util.annotations
Enum SupportedAnnotations

java.lang.Object
  extended by java.lang.Enum<SupportedAnnotations>
      extended by nl.jqno.equalsverifier.util.annotations.SupportedAnnotations
All Implemented Interfaces:
Serializable, Comparable<SupportedAnnotations>, Annotation

public enum SupportedAnnotations
extends Enum<SupportedAnnotations>
implements Annotation

Descriptions of the annotations that EqualsVerifier supports. The actual annotations cannot be referenced here, as that would create dependencies on the libraries that contain them, and it would preclude people from creating and using their own annotations with the same name.

Author:
Jan Ouwens

Enum Constant Summary
ECLIPSE_DEFAULT_ANNOTATION_NONNULL
           
ENTITY
          JPA Entities cannot be final, nor can their fields be.
FINDBUGS1X_DEFAULT_ANNOTATION_NONNULL
          If a class or package is marked with @DefaultAnnotation(Nonnull.class), EqualsVerifier will not complain about potential NullPointerExceptions being thrown if any of the fields in that class or package are null.
IMMUTABLE
          If a class is marked @Immutable, EqualsVerifier will not complain about fields not being final.
JSR305_DEFAULT_ANNOTATION_NONNULL
           
JSR305_TYPE_QUALIFIER_DEFAULT
           
NONNULL
          If a field is marked @Nonnull (or @NonNull or @NotNull), EqualsVerifier will not complain about potential NullPointerExceptions being thrown if this field is null.
NULLABLE
           
TRANSIENT
          Fields in JPA Entities that are marked @Transient should not be included in the equals/hashCode contract, like fields that have the Java transient modifier.
 
Method Summary
 Iterable<String> descriptors()
          One or more strings that contain the annotation's class name.
 boolean inherits()
          Whether the annotation applies to the class in which is appears only, or whether it applies to that class and all its subclasses.
 boolean validate(AnnotationProperties properties)
          Validates the annotation based on its properties.
static SupportedAnnotations valueOf(String name)
          Returns the enum constant of this type with the specified name.
static SupportedAnnotations[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

IMMUTABLE

public static final SupportedAnnotations IMMUTABLE
If a class is marked @Immutable, EqualsVerifier will not complain about fields not being final.


NONNULL

public static final SupportedAnnotations NONNULL
If a field is marked @Nonnull (or @NonNull or @NotNull), EqualsVerifier will not complain about potential NullPointerExceptions being thrown if this field is null.


ENTITY

public static final SupportedAnnotations ENTITY
JPA Entities cannot be final, nor can their fields be. EqualsVerifier will not complain about non-final fields on @Entity, @Embeddable and @MappedSuperclass classes.


TRANSIENT

public static final SupportedAnnotations TRANSIENT
Fields in JPA Entities that are marked @Transient should not be included in the equals/hashCode contract, like fields that have the Java transient modifier. EqualsVerifier will treat these the same.


FINDBUGS1X_DEFAULT_ANNOTATION_NONNULL

public static final SupportedAnnotations FINDBUGS1X_DEFAULT_ANNOTATION_NONNULL
If a class or package is marked with @DefaultAnnotation(Nonnull.class), EqualsVerifier will not complain about potential NullPointerExceptions being thrown if any of the fields in that class or package are null. Note that @DefaultAnnotation is deprectated. Nevertheless, EqualsVerifier still supports it.


JSR305_DEFAULT_ANNOTATION_NONNULL

public static final SupportedAnnotations JSR305_DEFAULT_ANNOTATION_NONNULL

JSR305_TYPE_QUALIFIER_DEFAULT

public static final SupportedAnnotations JSR305_TYPE_QUALIFIER_DEFAULT

ECLIPSE_DEFAULT_ANNOTATION_NONNULL

public static final SupportedAnnotations ECLIPSE_DEFAULT_ANNOTATION_NONNULL

NULLABLE

public static final SupportedAnnotations NULLABLE
Method Detail

values

public static SupportedAnnotations[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (SupportedAnnotations c : SupportedAnnotations.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static SupportedAnnotations valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

descriptors

public Iterable<String> descriptors()
Description copied from interface: Annotation
One or more strings that contain the annotation's class name. A descriptor can be the annotation's fully qualified canonical name, or a substring thereof. An annotation can be described by more than one descriptor. For instance, @Nonnull, @NonNull and @NotNull have the same semantics; their descriptors can be grouped together in one Annotation instance.

Specified by:
descriptors in interface Annotation
Returns:
An Iterable of annotation descriptor strings.

inherits

public boolean inherits()
Description copied from interface: Annotation
Whether the annotation applies to the class in which is appears only, or whether it applies to that class and all its subclasses.

Specified by:
inherits in interface Annotation
Returns:
True if the annotation is inherited by subclasses of the class in which the annotation appears.

validate

public boolean validate(AnnotationProperties properties)
Description copied from interface: Annotation
Validates the annotation based on its properties.

Specified by:
validate in interface Annotation
Parameters:
properties - An object that contains information about the annotation.
Returns:
True if the annotation is valid and can be used as intended.


Copyright © 2015. All Rights Reserved.