View Javadoc
1   package org.apache.maven.tools.plugin.extractor.annotations.datamodel;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.plugins.annotations.Component;
23  
24  import java.lang.annotation.Annotation;
25  
26  /**
27   * @author Olivier Lamy
28   * @since 3.0
29   */
30  public class ComponentAnnotationContent
31      extends AnnotatedField
32      implements Component
33  {
34      private String roleClassName;
35  
36      private String hint;
37  
38      public ComponentAnnotationContent( String fieldName )
39      {
40          super( fieldName );
41      }
42  
43      public ComponentAnnotationContent( String fieldName, String role, String hint )
44      {
45          this( fieldName );
46          this.roleClassName = role;
47          this.hint = hint;
48      }
49  
50      @Override
51      public Class<?> role()
52      {
53          // not used
54          return null;
55      }
56  
57      public void setRoleClassName( String roleClassName )
58      {
59          this.roleClassName = roleClassName;
60      }
61  
62      public String getRoleClassName()
63      {
64          return roleClassName;
65      }
66  
67      @Override
68      public String hint()
69      {
70          return hint == null ? "" : hint;
71      }
72  
73      public void hint( String hint )
74      {
75          this.hint = hint;
76      }
77  
78      @Override
79      public Class<? extends Annotation> annotationType()
80      {
81          return null;
82      }
83  
84      @Override
85      public String toString()
86      {
87          final StringBuilder sb = new StringBuilder();
88          sb.append( super.toString() );
89          sb.append( "ComponentAnnotationContent" );
90          sb.append( "{role='" ).append( roleClassName ).append( '\'' );
91          sb.append( ", hint='" ).append( hint ).append( '\'' );
92          sb.append( '}' );
93          return sb.toString();
94      }
95  }