A Key is an object that can be looked up in a Map
| 22 | |
| 23 | // A Key is an object that can be looked up in a Map |
| 24 | type Key interface { |
| 25 | // Lookup checks whether this key is present in a given Map - returning false as its |
| 26 | // second result if not present, and true as its second result with the Val found if |
| 27 | // one is found. |
| 28 | // To provide optimistic defaults for unannotated files (formally - files on which the annotations |
| 29 | // checker has not been run), uses of `Lookup` such as `CheckProduce` and `CheckConsume` always |
| 30 | // return false (i.e. "don't trigger") if the key they wrap is not found in the map. |
| 31 | // Since not triggering on the level of a produce or consume trigger always results in fewer |
| 32 | // errors, this gives optimistic defaults to library code. |
| 33 | Lookup(Map) (Val, bool) |
| 34 | |
| 35 | // Object returns the underlying object that this annotation key can be interpreted as annotating |
| 36 | Object() types.Object |
| 37 | |
| 38 | // String returns a string representation of this annotation key |
| 39 | // These get stored into PrimitiveAnnotationKeys - so KEEP THEM COMPACT |
| 40 | // a good guideline would be the length of their name plus no more than 10 characters |
| 41 | String() string |
| 42 | |
| 43 | // equals returns true if the passed key is equal to this key |
| 44 | equals(Key) bool |
| 45 | |
| 46 | // copy returns a deep copy of this key |
| 47 | copy() Key |
| 48 | } |
| 49 | |
| 50 | // FieldAnnotationKey allows the Lookup of a field's Annotation in the Annotation map |
| 51 | type FieldAnnotationKey struct { |
no outgoing calls
no test coverage detected