Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/vm/share/options/Option.java
41155 views
1
/*
2
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
package vm.share.options;
24
import java.lang.annotation.*;
25
/**
26
* This annotation is the most useful one of the whole API.
27
* It is used to mark non-static fields of the object and to declare the
28
* corresponding options. The name of the option defaults to the name of the field.
29
* The help message for the option should also be also declared
30
* here (or it could be declared at the {@link ObjectFactory} level at any case it is mandatory).
31
* For non-simple option types a factory attribute should be provided which
32
* points to a class which implements {@link ObjectFactory} interface. That factory is
33
* then used to instantiate an object given the option value and to populate the
34
* annotated field.
35
*
36
* If a default value is provided it is used if the corresponding option is not declared
37
* at the command line. If it is not provided and there is no option then an error is thrown.
38
* For non-simple field types default values can be provided at ObjectFactory level.
39
* See also the documentation at the package level.).
40
*/
41
// kept at runtime, applied to fields only.
42
@Retention(RetentionPolicy.RUNTIME)
43
@Target(ElementType.FIELD)
44
public @interface Option
45
{
46
// these strings help to find out if the corresponding attribute was not defined.
47
final public static String defName = "[no name]";
48
final public static String defDefaultValue = "[no default]";
49
final public static String defDescription = "[no description]";
50
51
/**
52
* The name of the option, defaults to the name of the annotated field.
53
*/
54
String name() default defName;
55
/**
56
* The default value for the option, option is mandatory if it is not specified here
57
* and at the ObjectFactory level.
58
*/
59
String default_value() default defDefaultValue;
60
/**
61
* A short description of the option used to generate a help message.
62
*/
63
String description() default defDescription;
64
65
/**
66
* The factory class to use for instantiating the corresponding option.
67
*/
68
Class<? extends OptionObjectFactory> factory() default OptionObjectFactory.class;
69
}
70
71