Package com.sun.mirror.type

Examples of com.sun.mirror.type.ClassType


                    mojoDescriptor.setDescription(d.getDocComment());
                    mojoDescriptor.setGoal(goal.value());
                    MojoDescriptorTls.addDescriptor(mojoDescriptor);
                }
                //First visit super classes and interfaces recursively
                ClassType superclass = d.getSuperclass();
                if (shouldProcessClass(superclass)) {
                    visitClassDeclaration(superclass.getDeclaration());
                }
                Collection<InterfaceType> superinterfaces = d.getSuperinterfaces();
                for (InterfaceType superinterface : superinterfaces) {
                    visitInterfaceDeclaration(superinterface.getDeclaration());
                }
View Full Code Here


                        }
                    }
                }
                //Check in super classes
                if (d instanceof ClassDeclaration) {
                    ClassType superclass = ((ClassDeclaration) d).getSuperclass();
                    if (shouldProcessClass(superclass)) {
                        if (isMojo(superclass.getDeclaration())) {
                            return true;
                        }
                    }
                }
                return false;
View Full Code Here

                            Collection<TypeDeclaration> specifiedTypeDeclartions = env.getSpecifiedTypeDeclarations();
                            for (TypeDeclaration td : specifiedTypeDeclartions)
                            {
                                if ( td instanceof ClassDeclaration )
                                {
                                    ClassType superclass = ( ( ClassDeclaration ) td ).getSuperclass();

                                    while ( superclass != null )
                                    {
                                        if ( superclass.getDeclaration().equals( clientType ) )
                                        {
                                            addControlType( clientsMap, td, controlFieldType );
                                            break;
                                        }

                                        superclass = superclass.getSuperclass();
                                    }
                                }
                            }
                        }
                    }
View Full Code Here

            //
            // REVIEW: Does NOT check if the interfaces might implement ControlBean!
            // This is unnecessary for our impl, since our generated bean class directly
            // implements ControlBean, but other impls may choose to do otherwise.
            boolean foundControlBean = false;
            ClassType classType = (ClassType)fieldType;

            if (classType.getDeclaration() != null)
            {
                outer: while ( classType != null )
                {
                    Collection<InterfaceType> intfs = classType.getSuperinterfaces();
                    for ( InterfaceType intfType : intfs )
                    {
                        if ( intfType.getDeclaration().getQualifiedName().equals( "org.apache.beehive.controls.api.bean.ControlBean" ) )
                        {
                            foundControlBean = true;
                            break outer;
                        }
                    }
                    classType = classType.getSuperclass();
                }
                if ( !foundControlBean )
                    printError( f, "control.field.bad.classtype" );

                // Valid generated beans should only "implement" the control interface/extension, and no others
                classType = (ClassType)fieldType;
                Collection<InterfaceType> intfs = classType.getSuperinterfaces();
                if ( intfs.size() != 1 )
                {
                    printError( f, "control.field.bad.classtype.badinterface" );
                }
View Full Code Here

        {
            return ((InterfaceType)intfOrBeanClass).getDeclaration();
        }
        else if (intfOrBeanClass instanceof ClassType)
        {
            ClassType classType = (ClassType)intfOrBeanClass;

            // If the bean type declaration cannot be found, then the only (valid) possibility
            // is that it is a generated type from the current processor pass.   See if a base
            // interface type can be determined from the current processor input list.
            if (classType.getDeclaration() == null)
            {
                //
                // Compute the bean type name, and the associated interface name by stripping
                // the "Bean" suffix
                //
                String className = classType.toString();
                AnnotationProcessorEnvironment ape = getAnnotationProcessorEnvironment();
                InterfaceDeclaration id = null;
                String intfName = null;
                if (className.length() > 4) {
                    intfName = className.substring(0, className.length() - 4);
                    id = (InterfaceDeclaration)ape.getTypeDeclaration(intfName);
                }

                if (id == null && intfName != null)
                {
                    // The specified class name may not be fully qualified.  In this case, the
                    // best we can do is look for a best fit match against the input types
                    for (TypeDeclaration td :ape.getSpecifiedTypeDeclarations())
                    {
                        if (td instanceof InterfaceDeclaration &&
                            td.getSimpleName().equals(intfName))
                        {
                            return (InterfaceDeclaration)td;
                        }
                    }
                }
                return id;
            }
            else
            {
                // direct supers only
                Collection<InterfaceType> intfs = classType.getSuperinterfaces();

                // per the code in checkControlField, this set must be of size 1
                // and the 1 super interface must be a control interface/extension
                assert ( intfs.size() == 1 );
                for ( InterfaceType intfType : intfs )
View Full Code Here

                        Collection<TypeDeclaration> specifiedTypeDeclartions = env.getSpecifiedTypeDeclarations();
                        for (TypeDeclaration td : specifiedTypeDeclartions)
                        {
                            if (td instanceof ClassDeclaration)
                            {
                                ClassType superclass = ((ClassDeclaration) td).getSuperclass();
                                while (superclass != null)
                                {
                                    if (superclass.getDeclaration().equals(clientType))
                                    {
                                        addControlType(clientsMap, td, controlFieldType);
                                        break;
                                    }

                                    superclass = superclass.getSuperclass();
                                }
                            }
                        }
                    }
                }
View Full Code Here

            //
            // REVIEW: Does NOT check if the interfaces might implement ControlBean!
            // This is unnecessary for our impl, since our generated bean class directly
            // implements ControlBean, but other impls may choose to do otherwise.
            boolean foundControlBean = false;
            ClassType classType = (ClassType)fieldType;

            if (classType.getDeclaration() != null)
            {
                outer: while ( classType != null )
                {
                    Collection<InterfaceType> intfs = classType.getSuperinterfaces();
                    for ( InterfaceType intfType : intfs )
                    {
                        if ( intfType.getDeclaration().getQualifiedName().equals( "org.apache.beehive.controls.api.bean.ControlBean" ) )
                        {
                            foundControlBean = true;
                            break outer;
                        }
                    }
                    classType = classType.getSuperclass();
                }
                if ( !foundControlBean )
                    printError( f, "control.field.bad.classtype" );

                // Valid generated beans should only "implement" the control interface/extension, and no others
                classType = (ClassType)fieldType;
                Collection<InterfaceType> intfs = classType.getSuperinterfaces();
                if ( intfs.size() != 1 )
                {
                    printError( f, "control.field.bad.classtype.badinterface" );
                }
View Full Code Here

        {
            return ((InterfaceType)intfOrBeanClass).getDeclaration();
        }
        else if (intfOrBeanClass instanceof ClassType)
        {
            ClassType classType = (ClassType)intfOrBeanClass;

            // If the bean type declaration cannot be found, then the only (valid) possibility
            // is that it is a generated type from the current processor pass.   See if a base
            // interface type can be determined from the current processor input list.
            if (classType.getDeclaration() == null)
            {
                //
                // Compute the bean type name, and the associated interface name by stripping
                // the "Bean" suffix
                //
                String className = classType.toString();
                AnnotationProcessorEnvironment ape = getAnnotationProcessorEnvironment();
                InterfaceDeclaration id = null;
                String intfName = null;
                if (className.length() > 4) {
                    intfName = className.substring(0, className.length() - 4);
                    id = (InterfaceDeclaration)ape.getTypeDeclaration(intfName);
                }

                if (id == null && intfName != null)
                {
                    // The specified class name may not be fully qualified.  In this case, the
                    // best we can do is look for a best fit match against the input types
                    for (TypeDeclaration td :ape.getSpecifiedTypeDeclarations())
                    {
                        if (td instanceof InterfaceDeclaration &&
                            td.getSimpleName().equals(intfName))
                        {
                            return (InterfaceDeclaration)td;
                        }
                    }
                }
                return id;
            }
            else
            {
                // direct supers only
                Collection<InterfaceType> intfs = classType.getSuperinterfaces();

                // per the code in checkControlField, this set must be of size 1
                // and the 1 super interface must be a control interface/extension
                // a value of zero may be valid if the control field is not referencing
                // a control -- for this case fall through and return null.
View Full Code Here

     * Returns the fully qualified classname of the closest control client in the inheritance chain.
     * @return class name of the closest control client
     */
    public String getSuperClientName()
    {
        ClassType superType = _clientDecl.getSuperclass();

        while ( superType != null )
        {
            ClassDeclaration superDecl = superType.getDeclaration();

            Collection<FieldDeclaration> declaredFields = superDecl.getFields();
            for (FieldDeclaration fieldDecl : declaredFields)
            {
                if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.bean.Control.class) != null)
                {
                    // Found an @control annotated field, so return this class name
                    return superDecl.getQualifiedName();
                }
            }

            superType = superType.getSuperclass();
        }

        return null;
    }
View Full Code Here

    }

    public TypeDeclaration getSuperClass(TypeDeclaration t) {
        if (t instanceof ClassDeclaration) {
            ClassDeclaration c = (ClassDeclaration) t;
            ClassType sup = c.getSuperclass();
            if(sup!=null)
                return sup.getDeclaration();
            else
                return null;
        }
        return env.getTypeDeclaration(Object.class.getName());
    }
View Full Code Here

TOP

Related Classes of com.sun.mirror.type.ClassType

Copyright © 2018 www.massapicom. 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.