Class CandidateChecks
java.lang.Object
org.apache.groovy.contracts.generation.CandidateChecks
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.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic booleancouldBeContractElementMethodNode(ClassNode type, MethodNode method) Checks whether the givenMethodNodecould be a candidate for an arbitraryContractElementannotation.static booleanisClassInvariantCandidate(ClassNode type, MethodNode method) Decides whether the given method is a candidate for class invariants.static booleanisClassInvariantCandidate(PropertyNode propertyNode) Decides whether the given propertyNode is a candidate for class invariant injection.static booleanChecks whether the givenClassNodeis a candidate for applying contracts.static booleanChecks whether the givenClassNodeis a candidate for applying interface contracts.static booleanisPostconditionCandidate(ClassNode type, MethodNode method) Decides whether the given method is a candidate for a post-condition.static booleanisPreconditionCandidate(ClassNode type, MethodNode method) Decides whether the given method is a candidate for a pre-condition.static booleanisPreOrPostconditionCandidate(ClassNode type, MethodNode method) Decides whether the given method is a candidate for a pre- or postcondition.static booleanisRuntimeClass(ClassNode type) Checks whether the givenClassNodeis part of the Groovy/Java runtime.
- 
Constructor Details- 
CandidateCheckspublic CandidateChecks()
 
- 
- 
Method Details- 
isContractsCandidateChecks whether the givenClassNodeis 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- ClassNodeto be checked
- Returns:
- whether the given type is a candidate for applying contract assertions
 
- 
isInterfaceContractsCandidateChecks whether the givenClassNodeis a candidate for applying interface contracts.- Parameters:
- type- the- ClassNodeto be checked
- Returns:
- whether the given type is a candidate for applying interface contract assertions
 
- 
isClassInvariantCandidateDecides whether the given propertyNode is a candidate for class invariant injection.- Parameters:
- propertyNode- the- PropertyNodeto check
- Returns:
- whether the propertyNode is a candidate for injecting the class invariant or not
 
- 
isPreOrPostconditionCandidateDecides whether the given method is a candidate for a pre- or postcondition.- Parameters:
- type- the current- ClassNode
- method- the- MethodNodeto check for pre- or postcondition compliance
- Returns:
- whether the given MethodNodeis a candidate for pre- or postconditions
 
- 
isClassInvariantCandidateDecides whether the given method is a candidate for class invariants.- Parameters:
- type- the current- ClassNode
- method- the- MethodNodeto check for class invariant compliance
- Returns:
- whether the given MethodNodeis a candidate for class invariants
 
- 
isPreconditionCandidateDecides whether the given method is a candidate for a pre-condition.- Parameters:
- type- the current- ClassNode
- method- the- MethodNodeto check for pre-condition compliance
- Returns:
- whether the given MethodNodeis a candidate for pre-conditions
 
- 
isPostconditionCandidateDecides whether the given method is a candidate for a post-condition.- Parameters:
- type- the current- ClassNode
- method- the- MethodNodeto check for post-condition compliance
- Returns:
- whether the given MethodNodeis a candidate for post-conditions
 
- 
couldBeContractElementMethodNodeChecks whether the givenMethodNodecould be a candidate for an arbitraryContractElementannotation.- Parameters:
- type- the current- ClassNode
- method- the- MethodNodeto check for- ContractElementcompliance
- Returns:
- whether the given method node could be a candidate or not
 
- 
isRuntimeClassChecks whether the givenClassNodeis part of the Groovy/Java runtime.
 
-