public abstract class Contract extends Object
| Modifier and Type | Class and Description | 
|---|---|
| static class  | Contract.ConditionalPostconditionRepresents a conditional postcondition that must be verified by  BaseTypeVisitoror one
 of its subclasses. | 
| static class  | Contract.KindEnumerates the kinds of contracts. | 
| static class  | Contract.PostconditionA postcondition contract. | 
| static class  | Contract.PreconditionA precondition contract. | 
| Modifier and Type | Field and Description | 
|---|---|
| AnnotationMirror | annotationThe annotation on the type of expression, according to this contract. | 
| AnnotationMirror | contractAnnotationThe annotation that expressed this contract; used for diagnostic messages. | 
| String | expressionStringThe expression for which the condition must hold, such as  "foo"in@RequiresNonNull("foo"). | 
| Contract.Kind | kindThe kind of contract: precondition, postcondition, or conditional postcondition. | 
| Modifier and Type | Method and Description | 
|---|---|
| static Contract | create(Contract.Kind kind,
      String expressionString,
      AnnotationMirror annotation,
      AnnotationMirror contractAnnotation,
      Boolean ensuresQualifierIf)Creates a new Contract. | 
| boolean | equals(@Nullable Object o) | 
| int | hashCode() | 
| String | toString() | 
| AnnotationMirror | viewpointAdaptDependentTypeAnnotation(GenericAnnotatedTypeFactory<?,?,?,?> factory,
                                     StringToJavaExpression stringToJavaExpr,
                                     @Nullable Tree errorTree)Viewpoint-adapt  annotationusingstringToJavaExpr. | 
public final String expressionString
"foo" in
 @RequiresNonNull("foo").
 An annotation like @RequiresNonNull({"a", "b", "c"}) would be represented by
 multiple Contracts.
public final AnnotationMirror annotation
public final AnnotationMirror contractAnnotation
public final Contract.Kind kind
public static Contract create(Contract.Kind kind, String expressionString, AnnotationMirror annotation, AnnotationMirror contractAnnotation, Boolean ensuresQualifierIf)
kind - precondition, postcondition, or conditional postconditionexpressionString - the Java expression that should have a type qualifierannotation - the type qualifier that expressionString should havecontractAnnotation - the pre- or post-condition annotation that the programmer wrote; used
     for diagnostic messagesensuresQualifierIf - the ensuresQualifierIf field, for a conditional postconditionpublic AnnotationMirror viewpointAdaptDependentTypeAnnotation(GenericAnnotatedTypeFactory<?,?,?,?> factory, StringToJavaExpression stringToJavaExpr, @Nullable Tree errorTree)
annotation using stringToJavaExpr.
 For example, if the contract is @EnsuresKeyFor(value = "this.field", map = "map"),
 annotation is @KeyFor("map"). This method applies stringToJava to "map"
 and returns a new KeyFor annotation with the result.
factory - used to get DependentTypesHelperstringToJavaExpr - function used to convert strings to JavaExpressionserrorTree - if non-null, where to report any errors that occur when parsing the dependent
     type annotation; if null, report no errorsannotation if it is not a dependent type
     annotation