001    package org.apache.maven.tools.plugin.annotations.datamodel;
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.plugins.annotations.Component;
023    
024    import java.lang.annotation.Annotation;
025    
026    /**
027     * @author Olivier Lamy
028     * @since 3.0
029     */
030    public class ComponentAnnotationContent
031        extends AnnotatedField
032        implements Component
033    {
034        private String roleClassName;
035    
036        private String hint;
037    
038        public ComponentAnnotationContent( String fieldName )
039        {
040            super( fieldName );
041        }
042    
043        public ComponentAnnotationContent( String fieldName, String role, String hint )
044        {
045            this( fieldName );
046            this.roleClassName = role;
047            this.hint = hint;
048        }
049    
050        public Class<?> role()
051        {
052            // not used
053            return null;
054        }
055    
056        public void setRoleClassName( String roleClassName )
057        {
058            this.roleClassName = roleClassName;
059        }
060    
061        public String getRoleClassName()
062        {
063            return roleClassName;
064        }
065    
066        public String hint()
067        {
068            return hint == null ? "" : hint;
069        }
070    
071        public void hint( String hint )
072        {
073            this.hint = hint;
074        }
075    
076        public Class<? extends Annotation> annotationType()
077        {
078            return null;
079        }
080    
081        @Override
082        public String toString()
083        {
084            final StringBuilder sb = new StringBuilder();
085            sb.append( super.toString() );
086            sb.append( "ComponentAnnotationContent" );
087            sb.append( "{role='" ).append( roleClassName ).append( '\'' );
088            sb.append( ", hint='" ).append( hint ).append( '\'' );
089            sb.append( '}' );
090            return sb.toString();
091        }
092    }