Enum SupportedAnnotations

java.lang.Object
java.lang.Enum<SupportedAnnotations>
nl.jqno.equalsverifier.internal.reflection.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.

  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    If a class or package is marked with @NonNullByDefault, EqualsVerifier will not complain about potential NullPointerExceptions being thrown if any of the fields in that class or package are null.
    JPA Entities cannot be final, nor can their fields be.
    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.
    Fields in JPA Entities that are marked @Id or @EmbeddedId are usually part of the entity's surrogate key.
    If a class is marked @Immutable, EqualsVerifier will not complain about fields not being final.
    Represents any annotation that is marked with @Nonnull and @TypeQualifierDefault.
    If an annotation type is marked with JSR305's @TypeQualifierDefault annotation, it becomes a 'default' annotation for whatever other annotation it is marked with; for example @Nonnull.
     
    Fields in JPA Entities that are marked @NaturalId are part of the entity's natural/business identity.
    If a field is marked @Nonnull (or @NonNull or @NotNull), EqualsVerifier will not complain about potential NullPointerExceptions being thrown if this field is null.
    If a class is marked @Nonnull, @Nullable can be used to revert that for specific fields.
    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

    Modifier and Type
    Method
    Description
    boolean
    Whether the annotation applies to the class in which is appears only, or whether it applies to that class and all its subclasses.
    One or more strings that contain the annotation's (partial) class name.
    Returns the enum constant of this type with the specified name.
    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

    Methods inherited from interface nl.jqno.equalsverifier.internal.reflection.annotations.Annotation

    postProcess, validate
  • Enum Constant Details

    • 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.
    • NULLABLE

      public static final SupportedAnnotations NULLABLE
      If a class is marked @Nonnull, @Nullable can be used to revert that for specific fields.
    • 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 deprecated. Nevertheless, EqualsVerifier still supports it.

    • JSR305_DEFAULT_ANNOTATION_NONNULL

      public static final SupportedAnnotations JSR305_DEFAULT_ANNOTATION_NONNULL
      Represents any annotation that is marked with @Nonnull and @TypeQualifierDefault. If a class or package is marked with such an annotation, EqualsVerifier will not complain about potential NullPointerExceptions being thrown if any of the fields in that class or package are null.
    • JSR305_TYPE_QUALIFIER_DEFAULT

      public static final SupportedAnnotations JSR305_TYPE_QUALIFIER_DEFAULT
      If an annotation type is marked with JSR305's @TypeQualifierDefault annotation, it becomes a 'default' annotation for whatever other annotation it is marked with; for example @Nonnull.
    • ECLIPSE_DEFAULT_ANNOTATION_NONNULL

      public static final SupportedAnnotations ECLIPSE_DEFAULT_ANNOTATION_NONNULL
      If a class or package is marked with @NonNullByDefault, EqualsVerifier will not complain about potential NullPointerExceptions being thrown if any of the fields in that class or package are 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.
    • ID

      public static final SupportedAnnotations ID
      Fields in JPA Entities that are marked @Id or @EmbeddedId are usually part of the entity's surrogate key. EqualsVerifier will therefore assume that it must not be used in the equals/hashCode contract, unless Warning.SURROGATE_KEY is suppressed.
    • NATURALID

      public static final SupportedAnnotations NATURALID
      Fields in JPA Entities that are marked @NaturalId are part of the entity's natural/business identity. If a @NaturalId annotation is present in an entity, all fields marked with this annotation must be part of the equals/hashCode contract, and all fields NOT marked with it must NOT be part of the contract.
    • LAZY_FIELD

      public static final SupportedAnnotations LAZY_FIELD
  • Method Details

    • values

      public static SupportedAnnotations[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      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
    • partialClassNames

      public Set<String> partialClassNames()
      Description copied from interface: Annotation
      One or more strings that contain the annotation's (partial) class name. This can be the annotation's fully qualified canonical name, or a substring thereof.

      An annotation can be described by more than one partial class name. For instance, @Nonnull, @NonNull and @NotNull have the same semantics; their partialClassNames can be grouped together in one Annotation instance.

      Specified by:
      partialClassNames in interface Annotation
      Returns:
      A Set of potentially partial annotation class names.
    • 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.

      Note: this encompasses more than Inherited does: this flag also applies, for example, to annotations on fields that are declared in a superclass.

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