01 /*
02 * RunTime.java
03 *
04 * Copyright (c) 2008, The University of Sheffield.
05 *
06 * This file is part of GATE (see http://gate.ac.uk/), and is free
07 * software, licenced under the GNU Library General Public License,
08 * Version 2, June 1991 (in the distribution as file licence.html,
09 * and also available at http://gate.ac.uk/gate/licence.html).
10 *
11 * Ian Roberts, 27/Jul/2008
12 *
13 * $Id: RunTime.java 9845 2008-08-25 22:23:24Z ian_roberts $
14 */
15
16 package gate.creole.metadata;
17
18 import java.lang.annotation.Documented;
19 import java.lang.annotation.ElementType;
20 import java.lang.annotation.Retention;
21 import java.lang.annotation.RetentionPolicy;
22 import java.lang.annotation.Target;
23
24 /**
25 * Marker annotation used in conjunction with {@link CreoleParameter} to mark
26 * parameters that are runtime parameters as opposed to init-time ones. This
27 * annotation is named RunTime (camel-case) so as not to conflict with the
28 * {@link java.lang.Runtime} class in java.lang.
29 *
30 * <pre>
31 * @Optional
32 * @RunTime
33 * @CreoleParameter
34 * public void setAnnotationTypes(List<String> types) { ... }
35 * </pre>
36 *
37 * While usually used to mark parameters as runtime parameters, this annotation
38 * also supports an optional boolean flag, so it can be used as
39 * <code>@RunTime(false)</code> to mark init-time parameters. This is not
40 * generally necessary, as parameters are init-time by default, however if a
41 * given parameter has been annotated as <code>@RunTime</code> in a superclass
42 * this will be inherited. If you want to change the parameter to be init-time
43 * in a subclass then you must use <code>@RunTime(false)</code>.
44 */
45 @Documented
46 @Target( {ElementType.METHOD})
47 @Retention(RetentionPolicy.RUNTIME)
48 public @interface RunTime {
49 /**
50 * Defaults to true but can be set to false to explicitly mark a parameter as
51 * init-time rather than runtime.
52 */
53 boolean value() default true;
54 }
|