001/*
002 * Sonar, open source software quality management tool.
003 * Copyright (C) 2008-2012 SonarSource
004 * mailto:contact AT sonarsource DOT com
005 *
006 * Sonar is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * Sonar is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public
017 * License along with Sonar; if not, write to the Free Software
018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
019 */
020package org.sonar.api;
021
022import java.lang.annotation.ElementType;
023import java.lang.annotation.Retention;
024import java.lang.annotation.RetentionPolicy;
025import java.lang.annotation.Target;
026
027/**
028 * Property value can be set in different ways :
029 * <ul>
030 * <li>System property</li>
031 * <li>Maven command-line (-Dfoo=bar)</li>
032 * <li>Maven pom.xml (element <properties>)</li>
033 * <li>Maven settings.xml</li>
034 * <li>Sonar web interface</li>
035 * </ul>
036 * <p/>
037 * Value is accessible in batch extensions via the Configuration object of class <code>org.sonar.api.resources.Project</code>
038 * (see method <code>getConfiguration()</code>).
039 * <p/>
040 * <p><strong>Must be used in <code>org.sonar.api.Plugin</code> classes only.</strong></p>
041 *
042 * @since 1.10
043 */
044@Retention(RetentionPolicy.RUNTIME)
045@Target(ElementType.TYPE)
046public @interface Property {
047
048  /**
049   * Unique key within all plugins. It's recommended to prefix the key by 'sonar.' and the plugin name. Examples :
050   * 'sonar.cobertura.reportPath' and 'sonar.cpd.minimumTokens'.
051   */
052  String key();
053
054  /**
055   * The empty string "" is considered as null, so it's not possible to have empty strings for default values.
056   */
057  String defaultValue() default "";
058
059  String name();
060
061  String description() default "";
062
063  /**
064   * @since 2.11
065   */
066  String category() default "";
067
068  /**
069   * Is the property displayed in projet settings page ?
070   */
071  boolean project() default false;
072
073  /**
074   * Is the property displayed in module settings page ? A module is a maven sub-project.
075   */
076  boolean module() default false;
077
078  /**
079   * Is the property displayed in global settings page ?
080   */
081  boolean global() default true;
082
083  /**
084   * @since 3.0
085   */
086  PropertyType type() default PropertyType.STRING;
087
088  /**
089   * Options for *_LIST types
090   *
091   * @since 3.0
092   */
093  String[] options() default {};
094
095}