001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.data.util;
017
018import java.lang.annotation.ElementType;
019import java.lang.annotation.Retention;
020import java.lang.annotation.RetentionPolicy;
021import java.lang.annotation.Target;
022
023/**
024* Specifies paths which should be linked during automatic reference linking processes.
025*
026* <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
027* relative to the field. If no paths are specified, then the linking will start at the class or field that is
028* annotated.</p>
029*
030* <p>To prevent cascading of reference linking, this annotation can be specified with {@code cascade = false}.</p>
031*
032* @author Kuali Rice Rice (rice.collab@kuali.org)
033*/
034@Target({ElementType.FIELD, ElementType.TYPE})
035@Retention(RetentionPolicy.RUNTIME)
036public @interface Link {
037
038    /**
039    * Indicates whether or not linking should cascade through the specified path(s).
040    *
041    * @return true if reference linking should be cascaded, false otherwise
042    */
043    boolean cascade() default true;
044
045    /**
046    * Specify the path or paths (relative to the annotated class or field) at which to start the reference linking
047    * process. If no path specified, then linking will be performed on the annotated element and cascaded from there.
048    *
049    * @return the path or paths at which to start reference linking
050    */
051    String[] path() default {};
052
053}
054