aboutsummaryrefslogtreecommitdiffstats
path: root/docproc/src/main/java/com/yahoo/docproc/Accesses.java
blob: fa6d67f01fd268081ba527fd6c57970866fa8ab7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.docproc;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Docprocs tagged with this will read and/or write annotations on the given field(s).
 * 
 * @author vegardh
 */
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Accesses {

    Field[] value();

    /**
     * Describes the annotations produced and consumed on one field in a document
     *
     * @author vegardh
     */
    @Documented
    @Target(ElementType.TYPE)
    @Retention(RetentionPolicy.RUNTIME)
    @interface Field {

        /** The name of the document field */
        String name();
        /** The datatype of the field */
        String dataType();
        /** The trees of annotations that this docproc accesses on this field */
        Tree[] annotations() default {};
        String description();

        /**
         * Describes the annotations produced and consumed in one tree on a field
         *
         * @author vegardh
         */
        @Documented
        @Target(ElementType.TYPE)
        @Retention(RetentionPolicy.RUNTIME)
        @interface Tree {
            /** The name of the tree */
            String name() default "";
            /** The annotation types that this docproc writes in this tree */
            String[] produces() default {};
            /** The annotation types that this docproc requires in this tree */
            String[] consumes() default {};
        }
    }

}