1   /*
2    * Copyright 2017 LINE Corporation
3    *
4    * LINE Corporation licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package com.linecorp.centraldogma.client.updater;
17  
18  import java.lang.annotation.ElementType;
19  import java.lang.annotation.Retention;
20  import java.lang.annotation.RetentionPolicy;
21  import java.lang.annotation.Target;
22  
23  import javax.inject.Qualifier;
24  
25  /**
26   * Annotates a type to provide the necessary information to {@link CentralDogmaBeanFactory} so that the
27   * bean properties are mirrored from a file in Central Dogma.
28   *
29   * <pre>{@code
30   * > @CentralDogmaBean(project = "myProject",
31   * >                   repository = "myRepo",
32   * >                   path = "/foo.json")
33   * > public class Foo {
34   * >     private int a;
35   * >     private String b;
36   * >
37   * >     public int getA() { return a; }
38   * >     public void setA(int a) { this.a = a; }
39   * >     public String getB() { return b; }
40   * >     public void setB(String b) { this.b = b; }
41   * > }
42   * }</pre>
43   *
44   * @see CentralDogmaBeanConfig
45   */
46  @Qualifier
47  @Target(ElementType.TYPE)
48  @Retention(RetentionPolicy.RUNTIME)
49  public @interface CentralDogmaBean {
50      /**
51       * Central Dogma project name.
52       */
53      String project() default "";
54  
55      /**
56       * Central Dogma repository name.
57       */
58      String repository() default "";
59  
60      /**
61       * The path of the file in Central Dogma.
62       */
63      String path() default "";
64  
65      /**
66       * The JSON path expression that will be evaluated when retrieving the file at the {@link #path()}.
67       */
68      String jsonPath() default "";
69  
70      /**
71       * If {@code true}, the change of each bean property will be pushed to Central Dogma.
72       * Use this property with caution because it can result in unnecessarily large number of commits.
73       */
74      boolean bidirectional() default false;
75  }