001    /*
002     * SonarQube, open source software quality management tool.
003     * Copyright (C) 2008-2014 SonarSource
004     * mailto:contact AT sonarsource DOT com
005     *
006     * SonarQube 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     * SonarQube 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 License
017     * along with this program; if not, write to the Free Software Foundation,
018     * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019     */
020    package org.sonar.api.web;
021    
022    import java.lang.annotation.ElementType;
023    import java.lang.annotation.Retention;
024    import java.lang.annotation.RetentionPolicy;
025    import java.lang.annotation.Target;
026    
027    /**
028     * <p>
029     * Annotation used to specify which measures should be available on a snapshot to be able to display a view (page, tab, ...).
030     * It is possible to give a list of mandatory measures (= if one is not available, the view is not displayed) and/or a list of
031     * needed measures (only one of them needs to be available). The measures are specified using the metric keys.
032     * </p>
033     * <p>
034     * Example: the DesignPage absolutely requires the "dsm" measure to be fed in order to be displayed, whatever the language.
035     * The class will define a <code>@RequiredMeasures(allOf={"dsm"})</code> annotation.
036     * </p>
037     * 
038     * @since 3.0
039     */
040    @Retention(RetentionPolicy.RUNTIME)
041    @Target(ElementType.TYPE)
042    public @interface RequiredMeasures {
043    
044      /**
045       * Lists all the measures that must absolutely to be available on the snapshot in order to display the view.
046       * @return the list of mandatory measures, identified by their metric key
047       */
048      String[] allOf() default {};
049    
050      /**
051       * Lists all needed measures required to display the view. If only one of them is available on the snapshot, then the view 
052       * is displayed.
053       * @return the list of needed measures, identified by their metric key
054       */
055      String[] anyOf() default {};
056    
057    }