001 /*--------------------------------------------------------------------------+ 002 $Id: AOption.java 26283 2010-02-18 11:18:57Z juergens $ 003 | | 004 | Copyright 2005-2010 Technische Universitaet Muenchen | 005 | | 006 | Licensed under the Apache License, Version 2.0 (the "License"); | 007 | you may not use this file except in compliance with the License. | 008 | You may obtain a copy of the License at | 009 | | 010 | http://www.apache.org/licenses/LICENSE-2.0 | 011 | | 012 | Unless required by applicable law or agreed to in writing, software | 013 | distributed under the License is distributed on an "AS IS" BASIS, | 014 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 015 | See the License for the specific language governing permissions and | 016 | limitations under the License. | 017 +--------------------------------------------------------------------------*/ 018 package edu.tum.cs.commons.options; 019 020 import java.lang.annotation.Documented; 021 import java.lang.annotation.ElementType; 022 import java.lang.annotation.Retention; 023 import java.lang.annotation.RetentionPolicy; 024 import java.lang.annotation.Target; 025 026 /** 027 * Annotation for exposing methods as command line options. This should only be 028 * used with methods taking zero or one parameters. 029 * 030 * @author Benjamin Hummel 031 * @author $Author: juergens $ 032 * 033 * @version $Rev: 26283 $ 034 * @levd.rating GREEN Hash: D9BF68C91C99C85B1F1EF668BB0AAA71 035 */ 036 @Documented 037 @Retention(RetentionPolicy.RUNTIME) 038 @Target(ElementType.METHOD) 039 public @interface AOption { 040 /** The optional short (i.e. single character) name of the option. */ 041 char shortName() default 0; 042 043 /** The optional long (i.e. multi-character) name of the option. */ 044 String longName() default ""; 045 046 /** 047 * If this is set to true, all non-option arguments following the annotated 048 * option are used for this option. This results in multiple calls to this 049 * options setter method. 050 */ 051 boolean greedy() default false; 052 053 /** The description of this option used for usage messages. */ 054 String description(); 055 }