001package org.apache.maven.tools.plugin.extractor.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 022import org.apache.maven.plugins.annotations.Component; 023 024import java.lang.annotation.Annotation; 025 026/** 027 * @author Olivier Lamy 028 * @since 3.0 029 */ 030public 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 @Override 051 public Class<?> role() 052 { 053 // not used 054 return null; 055 } 056 057 public void setRoleClassName( String roleClassName ) 058 { 059 this.roleClassName = roleClassName; 060 } 061 062 public String getRoleClassName() 063 { 064 return roleClassName; 065 } 066 067 @Override 068 public String hint() 069 { 070 return hint == null ? "" : hint; 071 } 072 073 public void hint( String hint ) 074 { 075 this.hint = hint; 076 } 077 078 @Override 079 public Class<? extends Annotation> annotationType() 080 { 081 return null; 082 } 083 084 @Override 085 public String toString() 086 { 087 final StringBuilder sb = new StringBuilder(); 088 sb.append( super.toString() ); 089 sb.append( "ComponentAnnotationContent" ); 090 sb.append( "{role='" ).append( roleClassName ).append( '\'' ); 091 sb.append( ", hint='" ).append( hint ).append( '\'' ); 092 sb.append( '}' ); 093 return sb.toString(); 094 } 095}