001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. 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, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.maven.tools.plugin.extractor.annotations.scanner; 020 021import java.util.Arrays; 022import java.util.List; 023import java.util.Map; 024 025import org.apache.maven.plugins.annotations.Component; 026import org.apache.maven.plugins.annotations.Execute; 027import org.apache.maven.plugins.annotations.Mojo; 028import org.apache.maven.plugins.annotations.Parameter; 029import org.apache.maven.tools.plugin.extractor.ExtractionException; 030 031/** 032 * @author Olivier Lamy 033 * @since 3.0 034 */ 035public interface MojoAnnotationsScanner { 036 String ROLE = MojoAnnotationsScanner.class.getName(); 037 038 String V4_API_PLUGIN_PACKAGE = "org.apache.maven.api.plugin"; 039 040 String V4_API_ANNOTATIONS_PACKAGE = V4_API_PLUGIN_PACKAGE + ".annotations"; 041 042 List<String> CLASS_LEVEL_ANNOTATIONS = Arrays.asList( 043 Mojo.class.getName(), 044 Execute.class.getName(), 045 Deprecated.class.getName(), 046 V4_API_ANNOTATIONS_PACKAGE + ".Mojo", 047 V4_API_ANNOTATIONS_PACKAGE + ".Execute"); 048 049 List<String> FIELD_LEVEL_ANNOTATIONS = Arrays.asList( 050 Parameter.class.getName(), 051 Component.class.getName(), 052 Deprecated.class.getName(), 053 V4_API_ANNOTATIONS_PACKAGE + ".Parameter", 054 V4_API_ANNOTATIONS_PACKAGE + ".Component"); 055 056 List<String> METHOD_LEVEL_ANNOTATIONS = Arrays.asList( 057 Parameter.class.getName(), Deprecated.class.getName(), V4_API_ANNOTATIONS_PACKAGE + ".Parameter"); 058 059 /** 060 * Scan classes for mojo annotations. 061 * 062 * @param request 063 * @return map of mojo-annotated classes keyed by full class name 064 * @throws ExtractionException 065 */ 066 Map<String, MojoAnnotatedClass> scan(MojoAnnotationsScannerRequest request) throws ExtractionException; 067}