CandidateChecks (Groovy 5.0.0)

Package: org.apache.groovy.contracts.generation

## [Java] Class CandidateChecks

- org.apache.groovy.contracts.generation.CandidateChecks

-     public class CandidateChecks
      extends Object

  Functions in this class are used to determine whether a certain AST node fulfills certain assertion requirements. E.g. whether a class node is a class invariant candidate or not.

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static boolean` | `couldBeContractElementMethodNode(ClassNode type, MethodNode method)` Checks whether the given MethodNode could be a candidate for an arbitrary ContractElement annotation.
    `` | `public static boolean` | `isClassInvariantCandidate(PropertyNode propertyNode)` Decides whether the given `propertyNode` is a candidate for class invariant injection.
    `` | `public static boolean` | `isClassInvariantCandidate(ClassNode type, MethodNode method)` Decides whether the given `method` is a candidate for class invariants.
    `` | `public static boolean` | `isContractsCandidate(ClassNode type)` Checks whether the given ClassNode is a candidate for applying contracts.
    `` | `public static boolean` | `isInterfaceContractsCandidate(ClassNode type)` Checks whether the given ClassNode is a candidate for applying interface contracts.
    `` | `public static boolean` | `isPostconditionCandidate(ClassNode type, MethodNode method)` Decides whether the given `method` is a candidate for a post-condition.
    `` | `public static boolean` | `isPreOrPostconditionCandidate(ClassNode type, MethodNode method)` Decides whether the given `method` is a candidate for a pre- or postcondition.
    `` | `public static boolean` | `isPreconditionCandidate(ClassNode type, MethodNode method)` Decides whether the given `method` is a candidate for a pre-condition.
    `` | `public static boolean` | `isRuntimeClass(ClassNode type)` Checks whether the given ClassNode is part of the Groovy/Java runtime.

  - ### Inherited Methods Summary

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

- - ### Method Detail

    - #### public static boolean couldBeContractElementMethodNode(ClassNode type, MethodNode method)

      Checks whether the given MethodNode could be a candidate for an arbitrary ContractElement annotation.

      Parameters:
        `type` - the current ClassNode
        `method` - the MethodNode to check for ContractElement compliance
      Returns:
        whether the given method node could be a candidate or not

    - #### public static boolean isClassInvariantCandidate(PropertyNode propertyNode)

      Decides whether the given `propertyNode` is a candidate for class invariant injection.

      Parameters:
        `propertyNode` - the PropertyNode to check
      Returns:
        whether the `propertyNode` is a candidate for injecting the class invariant or not

    - #### public static boolean isClassInvariantCandidate(ClassNode type, MethodNode method)

      Decides whether the given `method` is a candidate for class invariants.

      Parameters:
        `type` - the current ClassNode
        `method` - the MethodNode to check for class invariant compliance
      Returns:
        whether the given MethodNode is a candidate for class invariants

    - #### public static boolean isContractsCandidate(ClassNode type)

      Checks whether the given ClassNode is a candidate for applying contracts.

      If the given class node has already been processed in this compilation run, this method will return `false`.

      Parameters:
        `type` - the ClassNode to be checked
      Returns:
        whether the given `type` is a candidate for applying contract assertions

    - #### public static boolean isInterfaceContractsCandidate(ClassNode type)

      Checks whether the given ClassNode is a candidate for applying interface contracts.

      Parameters:
        `type` - the ClassNode to be checked
      Returns:
        whether the given `type` is a candidate for applying interface contract assertions

    - #### public static boolean isPostconditionCandidate(ClassNode type, MethodNode method)

      Decides whether the given `method` is a candidate for a post-condition.

      Parameters:
        `type` - the current ClassNode
        `method` - the MethodNode to check for post-condition compliance
      Returns:
        whether the given MethodNode is a candidate for post-conditions

    - #### public static boolean isPreOrPostconditionCandidate(ClassNode type, MethodNode method)

      Decides whether the given `method` is a candidate for a pre- or postcondition.

      Parameters:
        `type` - the current ClassNode
        `method` - the MethodNode to check for pre- or postcondition compliance
      Returns:
        whether the given MethodNode is a candidate for pre- or postconditions

    - #### public static boolean isPreconditionCandidate(ClassNode type, MethodNode method)

      Decides whether the given `method` is a candidate for a pre-condition.

      Parameters:
        `type` - the current ClassNode
        `method` - the MethodNode to check for pre-condition compliance
      Returns:
        whether the given MethodNode is a candidate for pre-conditions

    - #### public static boolean isRuntimeClass(ClassNode type)

      Checks whether the given ClassNode is part of the Groovy/Java runtime.

      Parameters:
        `type` - the current ClassNode
      Returns:
        `true` whether the current ClassNode is a Groovy/Java system class