|
| 1 | +package org.mobilitydata.gtfsvalidator.annotation; |
| 2 | + |
| 3 | +import java.lang.annotation.ElementType; |
| 4 | +import java.lang.annotation.Retention; |
| 5 | +import java.lang.annotation.RetentionPolicy; |
| 6 | +import java.lang.annotation.Target; |
| 7 | +import org.mobilitydata.gtfsvalidator.notice.SeverityLevel; |
| 8 | +import org.mobilitydata.gtfsvalidator.table.GtfsEntity; |
| 9 | + |
| 10 | +/** |
| 11 | + * An annotation used to identify, configure, and document a validation notice. All notices should |
| 12 | + * be annotated with this type. |
| 13 | + */ |
| 14 | +@Retention(RetentionPolicy.RUNTIME) |
| 15 | +@Target(ElementType.TYPE) |
| 16 | +public @interface GtfsValidationNotice { |
| 17 | + |
| 18 | + /** |
| 19 | + * The default severity level for the notice. The actual severity level may be configured to be |
| 20 | + * different at validation time. |
| 21 | + */ |
| 22 | + SeverityLevel severity(); |
| 23 | + |
| 24 | + /** |
| 25 | + * GTFS specification file references used in automatic documentation generation for the notice. |
| 26 | + */ |
| 27 | + FileRefs files() default @FileRefs({}); |
| 28 | + |
| 29 | + /** |
| 30 | + * GTFS Best Practices file references used in automatic documentation generation for the notice. |
| 31 | + */ |
| 32 | + BestPracticesRefs bestPractices() default @BestPracticesRefs({}); |
| 33 | + |
| 34 | + /** |
| 35 | + * Arbitrary documentation reference urls used in automatic documentation generation for the |
| 36 | + * notice. |
| 37 | + */ |
| 38 | + UrlRef[] urls() default {}; |
| 39 | + |
| 40 | + /** |
| 41 | + * Annotation used in notice documentation to specify a link to the specification documentation |
| 42 | + * for a specific GTFS file, as identified by its table schema. |
| 43 | + */ |
| 44 | + @Retention(RetentionPolicy.RUNTIME) |
| 45 | + @Target(ElementType.TYPE) |
| 46 | + @interface BestPracticesRefs { |
| 47 | + /** The set of GTFS table schemas corresponding to the GTFS file in question. */ |
| 48 | + Class<? extends GtfsEntity>[] value(); |
| 49 | + } |
| 50 | + |
| 51 | + /** |
| 52 | + * Annotation used in notice documentation to specify a link to the Best Practices documentation |
| 53 | + * for a specific GTFS file, as identified by its table schema. |
| 54 | + */ |
| 55 | + @Retention(RetentionPolicy.RUNTIME) |
| 56 | + @Target(ElementType.TYPE) |
| 57 | + @interface FileRefs { |
| 58 | + /** The set of GTFS table schemas corresponding to the GTFS file in question. */ |
| 59 | + Class<? extends GtfsEntity>[] value(); |
| 60 | + |
| 61 | + /** True if a particular notice applies to all files in the GTFS spec. */ |
| 62 | + boolean allFiles() default false; |
| 63 | + } |
| 64 | + |
| 65 | + /** |
| 66 | + * Annotation used in notice documentation to specify a general reference URL for a notice. For |
| 67 | + * links to specific GTFS file references and best-practices, use {@link FileRefs} or {@link |
| 68 | + * BestPracticesRefs} instead. |
| 69 | + */ |
| 70 | + @Retention(RetentionPolicy.RUNTIME) |
| 71 | + @Target(ElementType.TYPE) |
| 72 | + @interface UrlRef { |
| 73 | + |
| 74 | + /** The human-readable text used to display the url. */ |
| 75 | + String label(); |
| 76 | + |
| 77 | + /** The reference URL. */ |
| 78 | + String url(); |
| 79 | + } |
| 80 | +} |
0 commit comments