Examples of DocletTag


Examples of com.thoughtworks.qdox.model.DocletTag

    private boolean isJcrMultiple;

    static FieldDescriptor fromField(Log log, JavaField field) {

        DocletTag tag = field.getTagByName(TAG_FIELD_DESCRIPTOR);
        if (tag == null) {
            return null;
        }

        return new FieldDescriptor(log, tag, field.getName());
View Full Code Here

Examples of com.thoughtworks.qdox.model.DocletTag

        return new FieldDescriptor(log, tag, field.getName());
    }

    static FieldDescriptor fromMethod(Log log, JavaMethod method) {

        DocletTag tag = method.getTagByName(TAG_FIELD_DESCRIPTOR);
        if (tag == null) {
            return null;
        }

        // field name is the method name, unless overwritten with the fieldName
        // tag
        String fieldName = tag.getNamedParameter(FIELD_NAME);
        if (fieldName == null) {
            fieldName = getFieldFromMethod(method);
        }

        return new FieldDescriptor(log, tag, fieldName);
View Full Code Here

Examples of com.thoughtworks.qdox.model.DocletTag

    private String collectionConverter;

    static CollectionDescriptor fromField(Log log, JavaField field) {

        DocletTag tag = field.getTagByName(TAG_COLLECTION_DESCRIPTOR);
        if (tag == null) {
            return null;
        }

        return new CollectionDescriptor(log, tag, field.getName());
View Full Code Here

Examples of com.thoughtworks.qdox.model.DocletTag

        return new CollectionDescriptor(log, tag, field.getName());
    }

    static CollectionDescriptor fromMethod(Log log, JavaMethod method) {

        DocletTag tag = method.getTagByName(TAG_COLLECTION_DESCRIPTOR);
        if (tag == null) {
            return null;
        }

        // field name is the method name, unless overwritten with the fieldName
        // tag
        String fieldName = tag.getNamedParameter(FIELD_NAME);
        if (fieldName == null) {
            fieldName = getFieldFromMethod(method);
        }

        return new CollectionDescriptor(log, tag, fieldName);
View Full Code Here

Examples of com.thoughtworks.qdox.model.DocletTag

        JavaSource[] javaSources = builder.getSources();
        List descriptors = new ArrayList();
        for (int i = 0; i < javaSources.length; i++) {
            JavaClass[] javaClasses = javaSources[i].getClasses();
            for (int j = 0; javaClasses != null && j < javaClasses.length; j++) {
                DocletTag tag = javaClasses[j].getTagByName(ClassDescriptor.TAG_CLASS_DESCRIPTOR);
                if (tag != null) {
                    ClassDescriptor descriptor = this.createClassDescriptor(javaClasses[j]);
                    if (descriptor != null) {
                        descriptors.add(descriptor);
                    } else {
View Full Code Here

Examples of com.thoughtworks.qdox.model.DocletTag

    private String converter;

    static BeanDescriptor fromField(Log log, JavaField field) {

        DocletTag tag = field.getTagByName(TAG_BEAN_DESCRIPTOR);
        if (tag == null) {
            return null;
        }

        return new BeanDescriptor(log, tag, field.getName());
View Full Code Here

Examples of com.thoughtworks.qdox.model.DocletTag

        return new BeanDescriptor(log, tag, field.getName());
    }

    static BeanDescriptor fromMethod(Log log, JavaMethod method) {

        DocletTag tag = method.getTagByName(TAG_BEAN_DESCRIPTOR);
        if (tag == null) {
            return null;
        }

        // field name is the method name, unless overwritten with the fieldName
        // tag
        String fieldName = tag.getNamedParameter(FIELD_NAME);
        if (fieldName == null) {
            fieldName = getFieldFromMethod(method);
        }

        return new BeanDescriptor(log, tag, fieldName);
View Full Code Here

Examples of com.thoughtworks.qdox.model.DocletTag

    private List children;

    static ClassDescriptor fromClass(Log log, JavaClass javaClass) {

        DocletTag tag = javaClass.getTagByName(TAG_CLASS_DESCRIPTOR);
        if (tag == null) {
            return null;
        }

        ClassDescriptor cd = new ClassDescriptor(log, tag);
        cd.className = javaClass.getFullyQualifiedName();
        cd.isInterface = javaClass.isInterface();
        cd.isAbstract = !cd.isInterface && javaClass.isAbstract();

        cd.extend = tag.getNamedParameter(EXTEND);
        if (cd.extend == null) {
            if (javaClass.getSuperJavaClass() != null) {
                cd.extend = javaClass.getSuperJavaClass().getFullyQualifiedName();

                // do not declare extending Object :-)
                if (Object.class.getName().equals(cd.extend)) {
                    cd.extend = null;
                }
            }
        } else if (cd.extend.length() == 0) {
            // explicit empty extend value prevents extend attribute from being
            // set
            cd.extend = null;
        }

        String interfaceList = tag.getNamedParameter(INTERFACES);
        if (interfaceList == null) {
            if (javaClass.getImplementedInterfaces() != null) {
                JavaClass[] implInterfaces = javaClass.getImplementedInterfaces();
                cd.interfaces = new HashSet();
                for (int i = 0; i < implInterfaces.length; i++) {
                    cd.interfaces.add(implInterfaces[i].getFullyQualifiedName());
                }
            }
        } else if (interfaceList.length() == 0) {
            // empty interface list prevents creation of interface element
            cd.interfaces = null;
        } else {
            // split list and create set for interface elements
            StringTokenizer tokener = new StringTokenizer(interfaceList, ",");
            cd.interfaces = new HashSet();
            while (tokener.hasMoreTokens()) {
                String iface = tokener.nextToken().trim();
                if (iface.length() > 0) {
                    cd.interfaces.add(iface);
                }
            }
        }

        cd.jcrType = tag.getNamedParameter(JCR_TYPE);
        cd.jcrSuperTypes = tag.getNamedParameter(JCR_SUPER_TYPES);
        cd.jcrMixinTypes = tag.getNamedParameter(JCR_MIXIN_TYPES);

        // only reset default if explicitly stated
        if (tag.getNamedParameter(DISCRIMINATOR) != null) {
            cd.discriminator = Boolean.valueOf(
                tag.getNamedParameter(DISCRIMINATOR)).booleanValue();
        }

        return cd;
    }
View Full Code Here

Examples of com.thoughtworks.qdox.model.DocletTag

        // ----------------------------------------------------------------------
        // Mojo annotations in alphabetical order
        // ----------------------------------------------------------------------

        // Aggregator flag
        DocletTag aggregator = findInClassHierarchy( javaClass, JavaMojoAnnotation.AGGREGATOR );
        if ( aggregator != null )
        {
            mojoDescriptor.setAggregator( true );
        }

        // Configurator hint
        DocletTag configurator = findInClassHierarchy( javaClass, JavaMojoAnnotation.CONFIGURATOR );
        if ( configurator != null )
        {
            mojoDescriptor.setComponentConfigurator( configurator.getValue() );
        }

        // Additional phase to execute first
        DocletTag execute = findInClassHierarchy( javaClass, JavaMojoAnnotation.EXECUTE );
        if ( execute != null )
        {
            String executePhase = execute.getNamedParameter( JavaMojoAnnotation.EXECUTE_PHASE );
            String executeGoal = execute.getNamedParameter( JavaMojoAnnotation.EXECUTE_GOAL );

            if ( executePhase == null && executeGoal == null )
            {
                throw new InvalidPluginDescriptorException( javaClass.getFullyQualifiedName()
                    + ": @execute tag requires either a 'phase' or 'goal' parameter" );
            }
            else if ( executePhase != null && executeGoal != null )
            {
                throw new InvalidPluginDescriptorException( javaClass.getFullyQualifiedName()
                    + ": @execute tag can have only one of a 'phase' or 'goal' parameter" );
            }
            mojoDescriptor.setExecutePhase( executePhase );
            mojoDescriptor.setExecuteGoal( executeGoal );

            String lifecycle = execute.getNamedParameter( JavaMojoAnnotation.EXECUTE_LIFECYCLE );
            if ( lifecycle != null )
            {
                mojoDescriptor.setExecuteLifecycle( lifecycle );
                if ( mojoDescriptor.getExecuteGoal() != null )
                {
                    throw new InvalidPluginDescriptorException( javaClass.getFullyQualifiedName()
                        + ": @execute lifecycle requires a phase instead of a goal" );
                }
            }
        }

        // Goal name
        DocletTag goal = findInClassHierarchy( javaClass, JavaMojoAnnotation.GOAL );
        if ( goal != null )
        {
            mojoDescriptor.setGoal( goal.getValue() );
        }

        // inheritByDefault flag
        boolean value =
            getBooleanTagValue( javaClass, JavaMojoAnnotation.INHERIT_BY_DEFAULT,
                                mojoDescriptor.isInheritedByDefault() );
        mojoDescriptor.setInheritedByDefault( value );

        // instantiationStrategy
        DocletTag tag = findInClassHierarchy( javaClass, JavaMojoAnnotation.INSTANTIATION_STRATEGY );
        if ( tag != null )
        {
            mojoDescriptor.setInstantiationStrategy( tag.getValue() );
        }

        // executionStrategy (and deprecated @attainAlways)
        tag = findInClassHierarchy( javaClass, JavaMojoAnnotation.MULTI_EXECUTION_STRATEGY );
        if ( tag != null )
        {
            getLogger().warn( "@" + JavaMojoAnnotation.MULTI_EXECUTION_STRATEGY + " in "
                                  + javaClass.getFullyQualifiedName() + " is deprecated: please use '@"
                                  + JavaMojoAnnotation.EXECUTION_STATEGY + " always' instead." );
            mojoDescriptor.setExecutionStrategy( MojoDescriptor.MULTI_PASS_EXEC_STRATEGY );
        }
        else
        {
            mojoDescriptor.setExecutionStrategy( MojoDescriptor.SINGLE_PASS_EXEC_STRATEGY );
        }
        tag = findInClassHierarchy( javaClass, JavaMojoAnnotation.EXECUTION_STATEGY );
        if ( tag != null )
        {
            mojoDescriptor.setExecutionStrategy( tag.getValue() );
        }

        // Phase name
        DocletTag phase = findInClassHierarchy( javaClass, JavaMojoAnnotation.PHASE );
        if ( phase != null )
        {
            mojoDescriptor.setPhase( phase.getValue() );
        }

        // Dependency resolution flag
        DocletTag requiresDependencyResolution =
            findInClassHierarchy( javaClass, JavaMojoAnnotation.REQUIRES_DEPENDENCY_RESOLUTION );
        if ( requiresDependencyResolution != null )
        {
            String v = requiresDependencyResolution.getValue();

            if ( StringUtils.isEmpty( v ) )
            {
                v = "runtime";
            }

            mojoDescriptor.setDependencyResolutionRequired( v );
        }

        // Dependency collection flag
        DocletTag requiresDependencyCollection =
            findInClassHierarchy( javaClass, JavaMojoAnnotation.REQUIRES_DEPENDENCY_COLLECTION );
        if ( requiresDependencyCollection != null )
        {
            String v = requiresDependencyCollection.getValue();

            if ( StringUtils.isEmpty( v ) )
            {
                v = "runtime";
            }

            mojoDescriptor.setDependencyCollectionRequired( v );
        }

        // requiresDirectInvocation flag
        value =
            getBooleanTagValue( javaClass, JavaMojoAnnotation.REQUIRES_DIRECT_INVOCATION,
                                mojoDescriptor.isDirectInvocationOnly() );
        mojoDescriptor.setDirectInvocationOnly( value );

        // Online flag
        value =
            getBooleanTagValue( javaClass, JavaMojoAnnotation.REQUIRES_ONLINE, mojoDescriptor.isOnlineRequired() );
        mojoDescriptor.setOnlineRequired( value );

        // Project flag
        value =
            getBooleanTagValue( javaClass, JavaMojoAnnotation.REQUIRES_PROJECT, mojoDescriptor.isProjectRequired() );
        mojoDescriptor.setProjectRequired( value );

        // requiresReports flag
        value =
            getBooleanTagValue( javaClass, JavaMojoAnnotation.REQUIRES_REPORTS, mojoDescriptor.isRequiresReports() );
        mojoDescriptor.setRequiresReports( value );

        // ----------------------------------------------------------------------
        // Javadoc annotations in alphabetical order
        // ----------------------------------------------------------------------

        // Deprecation hint
        DocletTag deprecated = javaClass.getTagByName( JavaMojoAnnotation.DEPRECATED );
        if ( deprecated != null )
        {
            mojoDescriptor.setDeprecated( deprecated.getValue() );
        }

        // What version it was introduced in
        DocletTag since = findInClassHierarchy( javaClass, JavaMojoAnnotation.SINCE );
        if ( since != null )
        {
            mojoDescriptor.setSince( since.getValue() );
        }

        // Thread-safe mojo

        value = getBooleanTagValue( javaClass, JavaMojoAnnotation.THREAD_SAFE, true, mojoDescriptor.isThreadSafe() );
View Full Code Here

Examples of com.thoughtworks.qdox.model.DocletTag

            MojoAnnotationContent mojoAnnotationContent = entry.getValue().getMojo();
            if ( mojoAnnotationContent != null )
            {
                mojoAnnotationContent.setDescription( javaClass.getComment() );

                DocletTag since = findInClassHierarchy( javaClass, "since" );
                if ( since != null )
                {
                    mojoAnnotationContent.setSince( since.getValue() );
                }

                DocletTag deprecated = findInClassHierarchy( javaClass, "deprecated" );
                if ( deprecated != null )
                {
                    mojoAnnotationContent.setDeprecated( deprecated.getValue() );
                }
            }

            Map<String, JavaField> fieldsMap = extractFieldParameterTags( javaClass, javaClassesMap );

            // populate parameters
            Map<String, ParameterAnnotationContent> parameters =
                getParametersParentHierarchy( entry.getValue(), new HashMap<String, ParameterAnnotationContent>(),
                                              mojoAnnotatedClasses );
            for ( Map.Entry<String, ParameterAnnotationContent> parameter : new TreeMap<String, ParameterAnnotationContent>(
                parameters ).entrySet() )
            {
                JavaField javaField = fieldsMap.get( parameter.getKey() );
                if ( javaField == null )
                {
                    continue;
                }

                ParameterAnnotationContent parameterAnnotationContent = parameter.getValue();
                parameterAnnotationContent.setDescription( javaField.getComment() );

                DocletTag deprecated = javaField.getTagByName( "deprecated" );
                if ( deprecated != null )
                {
                    parameterAnnotationContent.setDeprecated( deprecated.getValue() );
                }

                DocletTag since = javaField.getTagByName( "since" );
                if ( since != null )
                {
                    parameterAnnotationContent.setSince( since.getValue() );
                }
            }

            // populate components
            for ( Map.Entry<String, ComponentAnnotationContent> component : entry.getValue().getComponents().entrySet() )
            {
                JavaField javaField = fieldsMap.get( component.getKey() );
                if ( javaField == null )
                {
                    continue;
                }

                ComponentAnnotationContent componentAnnotationContent = component.getValue();
                componentAnnotationContent.setDescription( javaField.getComment() );

                DocletTag deprecated = javaField.getTagByName( "deprecated" );
                if ( deprecated != null )
                {
                    componentAnnotationContent.setDeprecated( deprecated.getValue() );
                }

                DocletTag since = javaField.getTagByName( "since" );
                if ( since != null )
                {
                    componentAnnotationContent.setSince( since.getValue() );
                }
            }

        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.