forked from scijava/scijava-common
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParameter.java
More file actions
170 lines (147 loc) · 5.84 KB
/
Parameter.java
File metadata and controls
170 lines (147 loc) · 5.84 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
* #%L
* SciJava Common shared library for SciJava software.
* %%
* Copyright (C) 2009 - 2020 SciJava developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.scijava.plugin;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.scijava.ItemIO;
import org.scijava.ItemVisibility;
import org.scijava.module.Module;
/**
* An annotation for indicating a field is an input or output parameter. This
* annotation is a useful way for plugins to declare their inputs and outputs
* simply.
*
* @author Johannes Schindelin
* @author Grant Harris
* @author Curtis Rueden
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Parameter {
/** Defines a label for the parameter. */
String label() default "";
/** Defines a description for the parameter. */
String description() default "";
/**
* Defines the input/output type of the parameter.
* <p>
* Choices are:
* </p>
* <ul>
* <li>INPUT: parameter is an input for the plugin.</li>
* <li>OUTPUT: parameter is an output for the plugin.</li>
* <li>BOTH: parameter is both and input and an output for the plugin. This
* type is used to indicate an object that is mutated somehow during
* execution.</li>
* </ul>
*/
// NB: We use the fully qualified name to work around a javac bug:
// http://bugs.sun.com/view_bug.do?bug_id=6512707
// See:
// http://groups.google.com/group/project-lombok/browse_thread/thread/c5568eb659cab203
ItemIO type() default org.scijava.ItemIO.INPUT;
/**
* Defines the "visibility" of the parameter.
* <p>
* Choices are:
* </p>
* <ul>
* <li>NORMAL: parameter is included in the history for purposes of data
* provenance, and included as a parameter when recording scripts.</li>
* <li>TRANSIENT: parameter is excluded from the history for the purposes of
* data provenance, but still included as a parameter when recording scripts.</li>
* <li>INVISIBLE: parameter is excluded from the history for the purposes of
* data provenance, and also excluded as a parameter when recording scripts.
* This option should only be used for parameters with no effect on the final
* output, such as a "verbose" flag.</li>
* <li>MESSAGE: parameter value is intended as a message only, not editable by
* the user nor included as an input or output parameter.</li>
* </ul>
*/
ItemVisibility visibility() default ItemVisibility.NORMAL;
/**
* Defines whether the parameter value should be filled programmatically, if
* possible.
*/
boolean autoFill() default true;
/** Defines whether the parameter value must be non-null. */
boolean required() default true;
/** Defines whether to remember the most recent value of the parameter. */
boolean persist() default true;
/** Defines a key to use for saving the value persistently. */
String persistKey() default "";
/** Defines a function that is called to initialize the parameter. */
String initializer() default "";
/**
* Defines a function that is called to validate the parameter value after it
* is marked as resolved.
*
* @see Module#resolveInput(String)
*/
String validater() default "";
/**
* Defines a function that is called whenever this parameter changes.
* <p>
* This mechanism enables interdependent parameters of various types. For
* example, two {@code int} parameters "width" and "height" could update each
* other when another {@code boolean} "Preserve aspect ratio" flag is set.
* </p>
*/
String callback() default "";
/**
* Defines the preferred widget style.
* <p>
* We do not use an {@code enum} because the styles need to be extensible. And
* we cannot use an interface-driven extensible enum pattern, because
* interfaces cannot be used as attributes within a Java annotation interface.
* So we fall back to strings!
* </p>
*/
String style() default "";
/** Defines the minimum allowed value (numeric parameters only). */
String min() default "";
/** Defines the maximum allowed value (numeric parameters only). */
String max() default "";
/** Defines the step size to use (numeric parameters only). */
String stepSize() default "";
/** Defines the format to use */
String format() default "";
/** Defines the list of possible values (multiple choice text fields only). */
String[] choices() default {};
/**
* A list of additional attributes which can be used to extend this annotation
* beyond its built-in capabilities.
*/
Attr[] attrs() default {};
/** @deprecated Replaced by {@link #style()}. */
@Deprecated
int columns() default 6;
}