1 49 50 package org.apache.avalon.meta.info.builder.tags; 51 52 import java.util.ArrayList ; 53 54 import org.apache.avalon.meta.info.ExtensionDescriptor; 55 56 import com.thoughtworks.qdox.model.DocletTag; 57 import com.thoughtworks.qdox.model.JavaClass; 58 59 65 public class ExtensionTag extends AbstractTag 66 { 67 68 71 public static final String KEY = "extension"; 72 73 76 public static final String LEGACY_URN_PARAM = "urn"; 77 78 81 public static final String LEGACY_KEY_PARAM = "key"; 82 83 86 public static final String ID_PARAM = "id"; 87 88 92 public ExtensionTag( final JavaClass clazz ) 93 { 94 super( clazz ); 95 } 96 97 101 public ExtensionDescriptor[] getExtensions() 102 { 103 final ArrayList list = new ArrayList (); 104 final DocletTag[] tags = 105 getJavaClass().getTagsByName( getNS() + Tags.DELIMITER + KEY ); 106 for( int i = 0; i < tags.length; i++ ) 107 { 108 list.add( getExtension( tags[i] ) ); 109 } 110 return (ExtensionDescriptor[])list.toArray( 111 new ExtensionDescriptor[ list.size() ] ); 112 } 113 114 private ExtensionDescriptor getExtension( DocletTag tag ) 115 { 116 String value = getNamedParameter( tag, TYPE_PARAM, null ); 117 if( value != null ) 118 { 119 final String type = resolveType( value ); 120 return new ExtensionDescriptor( type ); 121 } 122 else 123 { 124 value = getNamedParameter( tag, LEGACY_KEY_PARAM, null ); 125 if( value == null ) 126 { 127 value = getNamedParameter( tag, LEGACY_URN_PARAM, null ); 128 } 129 if( value == null ) 130 { 131 value = getNamedParameter( tag, ID_PARAM ); 132 } 133 return new ExtensionDescriptor( value ); 134 } 135 } 136 } 137 | Popular Tags |