1 /**
2 * Copyright 2005-2014 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
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,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.krad.data.util;
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 /**
24 * Specifies paths which should be linked during automatic reference linking processes.
25 *
26 * <p>If specified on a class, the path(s) will be relative to the class. If specified on a field, the path(s) will be
27 * relative to the field. If no paths are specified, then the linking will start at the class or field that is
28 * annotated.</p>
29 *
30 * <p>To prevent cascading of reference linking, this annotation can be specified with {@code cascade = false}.</p>
31 *
32 * @author Kuali Rice Rice (rice.collab@kuali.org)
33 */
34 @Target({ElementType.FIELD, ElementType.TYPE})
35 @Retention(RetentionPolicy.RUNTIME)
36 public @interface Link {
37
38 /**
39 * Indicates whether or not linking should cascade through the specified path(s).
40 *
41 * @return true if reference linking should be cascaded, false otherwise
42 */
43 boolean cascade() default true;
44
45 /**
46 * Specify the path or paths (relative to the annotated class or field) at which to start the reference linking
47 * process. If no path specified, then linking will be performed on the annotated element and cascaded from there.
48 *
49 * @return the path or paths at which to start reference linking
50 */
51 String[] path() default {};
52
53 }
54