1 49 50 package org.apache.avalon.meta.info.builder.tags; 51 52 import java.util.ArrayList ; 53 54 import org.apache.avalon.framework.Version; 55 import org.apache.avalon.meta.info.ReferenceDescriptor; 56 import org.apache.avalon.meta.info.ServiceDescriptor; 57 58 import com.thoughtworks.qdox.model.DocletTag; 59 import com.thoughtworks.qdox.model.JavaClass; 60 61 67 public class ServicesTag extends AbstractTag 68 { 69 72 public static final String KEY = "service"; 73 74 78 public ServicesTag( final JavaClass clazz ) 79 { 80 super( clazz ); 81 } 82 83 87 public ServiceDescriptor[] getServices() 88 { 89 final ArrayList services = new ArrayList (); 90 final DocletTag[] tags = getJavaClass().getTagsByName( getNS() + Tags.DELIMITER + KEY ); 91 for( int i = 0; i < tags.length; i++ ) 92 { 93 services.add( getService( tags[i] ) ); 94 } 95 return (ServiceDescriptor[])services.toArray( new ServiceDescriptor[ services.size() ] ); 96 } 97 98 private ServiceDescriptor getService( DocletTag tag ) 99 { 100 final String value = getNamedParameter( tag, TYPE_PARAM ); 101 final String type = resolveType( value ); 102 final String versionString = getNamedParameter( tag, VERSION_PARAM, null ); 103 final Version version = resolveVersion( versionString, value ); 104 final ReferenceDescriptor ref = new ReferenceDescriptor( type, version ); 105 return new ServiceDescriptor( ref, null ); 106 } 107 } 108 | Popular Tags |