1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0
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 com.android.loganalysis.util.config;
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  * Annotates a class as representing a {@link IConfiguration} object.
25  */
26 //TODO: Use libTF once this is copied over.
27 @Retention(RetentionPolicy.RUNTIME)
28 @Target(ElementType.TYPE)
29 public @interface OptionClass {
30 
31     /**
32      * An optional descriptive alias for this configuration object.
33      * <p/>
34      * This alias will currently be used for two purposes:
35      * <ul>
36      * <li>displayed in help output, to help classify options</li>
37      * <li>
38      * can be used to namespace {@link Option} command line arguments, in cases where a given
39      * {@link Option#name()} is not unique amongst configuration objects. To provide a namespace
40      * with an {@link Option} command line argument, use this format: <p/>
41      * '--[OptionClass alias]:[Option name]'.
42      * </li>
43      * </ul>
44      */
alias()45     String alias();
46 
47     /**
48      * Whether or not to add this {@link Option} to the global Option namespace.
49      * <p />
50      * If <code>true</code> (the default), then it will be possible to specify this option simply
51      * by its name -- <code>--[Option name]</code>.  If <code>false</code>, then the alias or
52      * another specific namespace (such as the full classname) must be specified in order to use
53      * {@link Option}s for this class --
54      * <code>--[OptionClass alias]:[Option name]</code> will work, but <code>--[Option name]</code>
55      * won't resolve to the {@link Option}.
56      * <p />
57      * FIXME: update documentation methods to distinguish classes/fields that aren't in the global
58      * FIXME: namespace
59      */
global_namespace()60     boolean global_namespace() default true;
61 }
62