Requires (Groovy 5.0.0)

Package: groovy.contracts

## [Java] Annotation Type Requires

- groovy.contracts.Requires

-     @Retention(RetentionPolicy.RUNTIME)
      @Target({ElementType.CONSTRUCTOR, ElementType.METHOD})
      @Incubating
      @Precondition
      @AnnotationProcessorImplementation(RequiresAnnotationProcessor.class)
      @Repeatable(RequiresConditions.class)
      public @interface Requires

  Represents a method precondition.

  A precondition is a condition that must be met by clients of this class. Whenever the precondition can be satisfied, it is guaranteed that the supplier will fulfil the method's postcondition.

  A method's precondition is executed as the first statement within a method call. A successor's precondition weakens the precondition of its parent class, e.g. if A.someMethod declares a precondition and B.someMethod overrides the method the preconditions are combined with a boolean OR.

  Example:

         @Requires({ argument1 != argument2 && argument2 >= 0 })
         void someOperation(def argument1, def argument2)  {
           ...
         }

- - ### Element Summary

    Required Element Summary
    Type | Name and Description
    --- | ---
    `Class` | `value`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Element Detail

    - #### public Class value