001 package org.apache.maven.tools.plugin.annotations.scanner; 002 003 /* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022 import org.apache.maven.artifact.Artifact; 023 import org.apache.maven.tools.plugin.annotations.datamodel.ComponentAnnotationContent; 024 import org.apache.maven.tools.plugin.annotations.datamodel.ExecuteAnnotationContent; 025 import org.apache.maven.tools.plugin.annotations.datamodel.MojoAnnotationContent; 026 import org.apache.maven.tools.plugin.annotations.datamodel.ParameterAnnotationContent; 027 028 import java.util.HashMap; 029 import java.util.Map; 030 031 /** 032 * @author Olivier Lamy 033 * @since 3.0 034 */ 035 public class MojoAnnotatedClass 036 { 037 private String className; 038 039 private String parentClassName; 040 041 private MojoAnnotationContent mojo; 042 043 private ExecuteAnnotationContent execute; 044 045 /** 046 * key is field name 047 */ 048 private Map<String, ParameterAnnotationContent> parameters; 049 050 /** 051 * key is field name 052 */ 053 private Map<String, ComponentAnnotationContent> components; 054 055 /** 056 * artifact which contains this annotation 057 */ 058 private Artifact artifact; 059 060 public MojoAnnotatedClass() 061 { 062 // no op 063 } 064 065 public String getClassName() 066 { 067 return className; 068 } 069 070 public MojoAnnotatedClass setClassName( String className ) 071 { 072 this.className = className; 073 return this; 074 } 075 076 public MojoAnnotationContent getMojo() 077 { 078 return mojo; 079 } 080 081 public MojoAnnotatedClass setMojo( MojoAnnotationContent mojo ) 082 { 083 this.mojo = mojo; 084 return this; 085 } 086 087 public ExecuteAnnotationContent getExecute() 088 { 089 return execute; 090 } 091 092 public MojoAnnotatedClass setExecute( ExecuteAnnotationContent execute ) 093 { 094 this.execute = execute; 095 return this; 096 } 097 098 public Map<String, ParameterAnnotationContent> getParameters() 099 { 100 if ( this.parameters == null ) 101 { 102 this.parameters = new HashMap<String, ParameterAnnotationContent>(); 103 } 104 return parameters; 105 } 106 107 public MojoAnnotatedClass setParameters( Map<String, ParameterAnnotationContent> parameters ) 108 { 109 this.parameters = parameters; 110 return this; 111 } 112 113 public Map<String, ComponentAnnotationContent> getComponents() 114 { 115 if ( this.components == null ) 116 { 117 this.components = new HashMap<String, ComponentAnnotationContent>(); 118 } 119 return components; 120 } 121 122 public MojoAnnotatedClass setComponents( Map<String, ComponentAnnotationContent> components ) 123 { 124 this.components = components; 125 return this; 126 } 127 128 public String getParentClassName() 129 { 130 return parentClassName; 131 } 132 133 public MojoAnnotatedClass setParentClassName( String parentClassName ) 134 { 135 this.parentClassName = parentClassName; 136 return this; 137 } 138 139 public Artifact getArtifact() 140 { 141 return artifact; 142 } 143 144 public void setArtifact( Artifact artifact ) 145 { 146 this.artifact = artifact; 147 } 148 149 @Override 150 public String toString() 151 { 152 final StringBuilder sb = new StringBuilder(); 153 sb.append( "MojoAnnotatedClass" ); 154 sb.append( "{className='" ).append( className ).append( '\'' ); 155 sb.append( ", parentClassName='" ).append( parentClassName ).append( '\'' ); 156 sb.append( ", mojo=" ).append( mojo ); 157 sb.append( ", execute=" ).append( execute ); 158 sb.append( ", parameters=" ).append( parameters ); 159 sb.append( ", components=" ).append( components ); 160 sb.append( '}' ); 161 return sb.toString(); 162 } 163 }