Package com.sun.mirror.declaration

Examples of com.sun.mirror.declaration.InterfaceDeclaration


        // The field can either be declared as the bean type or the public interface type.
        // If it is the bean type, then we need to reflect to find the public interface
        // type it implements.
        //
        TypeDeclaration typeDecl = ((DeclaredType)controlType).getDeclaration();
        InterfaceDeclaration controlIntf = null;

        //
        // It is possible that the declared type is associated with a to-be-generated
        // bean type.  In this case, look for the associated control interface on the
        // processor input list.
        //
        if ( typeDecl == null )
        {
            String className = controlType.toString();
            String intfName = className.substring(0, className.length() - 4);
            controlIntf = (InterfaceDeclaration)_ap.getAnnotationProcessorEnvironment().getTypeDeclaration(intfName);
            if (controlIntf == 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 :_ap.getAnnotationProcessorEnvironment().getSpecifiedTypeDeclarations())
                {
                    if (td instanceof InterfaceDeclaration &&
                        td.getSimpleName().equals(intfName))
                    {
                        controlIntf = (InterfaceDeclaration)td;
                        break;
                    }
                }
            }
        }
        else if (typeDecl instanceof ClassDeclaration)
        {
            Collection<InterfaceType> implIntfs = ((ClassDeclaration)typeDecl).getSuperinterfaces();
            for (InterfaceType intfType : implIntfs)
            {
                InterfaceDeclaration intfDecl = intfType.getDeclaration();

                if ( intfDecl == null )
                    return null;
               
                if (intfDecl.getAnnotation(ControlInterface.class) != null||
                    intfDecl.getAnnotation(ControlExtension.class) != null)
                {
                    controlIntf = intfDecl;
                    break;
                }
            }
View Full Code Here


        if ( _intfDecl.getSuperinterfaces() == null )
            return null;

        for (InterfaceType intfType : _intfDecl.getSuperinterfaces())
        {
            InterfaceDeclaration superDecl = intfType.getDeclaration();
            if ( superDecl != null )
            {
                if (superDecl.getAnnotation(ControlExtension.class) != null ||
                    superDecl.getAnnotation(ControlInterface.class) != null)
                {
                    _superDecl = superDecl;
                    return intfType;
                }
            }
View Full Code Here

            try
            {
                Set<TypeMirror> controlTypes = clientsMap.get( clientType );
                for ( TypeMirror controlType : controlTypes )
                {
                    InterfaceDeclaration controlIntfOrExt = getControlInterfaceOrExtension(controlType);
                    InterfaceDeclaration controlIntf = getMostDerivedControlInterface( controlIntfOrExt );

                    assert controlIntf != null : "Can't find most derived control intf for=" + controlIntfOrExt;

                    ControlInterface annot = controlIntf.getAnnotation(ControlInterface.class);
                    String defBinding = annot.defaultBinding();

                    defBinding = ControlUtils.resolveDefaultBinding( defBinding, controlIntf.getQualifiedName() );

                    mf.addControlType( controlIntfOrExt.getQualifiedName(), defBinding );
                }

                mf.emit( f, clientPkg, clientManifestName, null );
View Full Code Here

         // Since our generate() does some detailed grovelling of control types, make sure that
         // will not result in an error by doing that grovelling now.  Control types may be
         // malformed if the source for those types has errors (yet the apt type may still exist!).
         try
         {
             InterfaceDeclaration controlIntfOrExt = getControlInterfaceOrExtension(fieldType);
             InterfaceDeclaration controlIntf = getMostDerivedControlInterface( controlIntfOrExt );

             if ( controlIntf != null )
             {
                 enforceVersionRequired( f, controlIntf );
             }
View Full Code Here

                // 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);
                }
View Full Code Here

     */
    private InterfaceDeclaration getMostDerivedControlInterface( InterfaceDeclaration controlIntfOrExt )
    {
        Queue<InterfaceDeclaration> q = new LinkedList<InterfaceDeclaration>();

        InterfaceDeclaration id = controlIntfOrExt;
        while ( id != null )
        {
            if ( id.getAnnotation(ControlInterface.class) != null )
                break;

            Collection<InterfaceType> supers = id.getSuperinterfaces();
            for ( InterfaceType s : supers )
                q.offer( s.getDeclaration() );

            id = q.poll();
        }
View Full Code Here

        // The field can either be declared as the bean type or the public interface type.
        // If it is the bean type, then we need to reflect to find the public interface
        // type it implements.
        //
        TypeDeclaration typeDecl = ((DeclaredType)controlType).getDeclaration();
        InterfaceDeclaration controlIntf = null;

        //
        // It is possible that the declared type is associated with a to-be-generated
        // bean type.  In this case, look for the associated control interface on the
        // processor input list.
        //
        if ( typeDecl == null )
        {
            String className = controlType.toString();
            String intfName = className.substring(0, className.length() - 4);
            String interfaceHint = getControlInterfaceHint();
            controlIntf = (InterfaceDeclaration)_ap.getAnnotationProcessorEnvironment().getTypeDeclaration(intfName);

            if (controlIntf == 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 :_ap.getAnnotationProcessorEnvironment().getSpecifiedTypeDeclarations())
                {
                    // if an interface hint was provided, use it to find the control interface,
                    // if not provided try to find the control interface by matching simple names.
                    if (interfaceHint != null) {
                        if (td instanceof InterfaceDeclaration &&
                                td.getQualifiedName().equals(interfaceHint))
                        {
                            controlIntf = (InterfaceDeclaration)td;
                            break;
                        }
                    }
                    else {
                        if (td instanceof InterfaceDeclaration &&
                            td.getSimpleName().equals(intfName))
                        {
                            controlIntf = (InterfaceDeclaration)td;
                            break;
                        }
                    }
                }
            }
        }
        else if (typeDecl instanceof ClassDeclaration)
        {
            Collection<InterfaceType> implIntfs = ((ClassDeclaration)typeDecl).getSuperinterfaces();
            for (InterfaceType intfType : implIntfs)
            {
                InterfaceDeclaration intfDecl = intfType.getDeclaration();

                if ( intfDecl == null )
                    return null;
               
                if (intfDecl.getAnnotation(ControlInterface.class) != null||
                    intfDecl.getAnnotation(ControlExtension.class) != null)
                {
                    controlIntf = intfDecl;
                    break;
                }
            }
View Full Code Here

        // Compute a hash set containing the qualified names of all super interfaces
        // for this EventSet
        HashSet<String> extendNames = new HashSet<String>();
        for (InterfaceType superType: _eventSet.getSuperinterfaces())
        {
            InterfaceDeclaration superDecl = superType.getDeclaration();
            if (superDecl != null)
                extendNames.add(superDecl.getQualifiedName());
        }

        // Starting with the parent of the ControlInterface declaring this EventSet, look
        // for a parent interface that declares ones of these super interfaces as an event
        // set
View Full Code Here

        //
        ArrayList<InterfaceDeclaration> intfList = new ArrayList<InterfaceDeclaration>();
        intfList.add(_eventSet);
        for (int i = 0; i < intfList.size(); i++)
        {
            InterfaceDeclaration intfDecl = intfList.get(i);

            //
            // Don't add events that are derived from a super event set.  These are not added because
            // this class picks a single super interface to extend from when building a hierarchy
            // of callback notifiers (etc).  So, the super event set that was chosen first is left out
            // of the list of event methods since they're captured in superclasses in the Control's implementation
            //
            if (_superEventSet != null && _superEventSet.getClassName().equals(intfDecl.getQualifiedName()))
                continue;

            // Add all declared methods, but ignore the mystery <clinit> methods
            for (MethodDeclaration methodDecl : intfDecl.getMethods())
                if (!methodDecl.toString().equals("<clinit>()"))
                    events.add(new AptEvent(this, methodDecl, _ap));

            //
            // Add all superinterfaces of the target interface to the list
            //
            for (InterfaceType superType: intfDecl.getSuperinterfaces())
            {
                InterfaceDeclaration superDecl = superType.getDeclaration();
                if (superDecl != null && !intfList.contains(superDecl))
                    intfList.add(superDecl);
            }
        }
View Full Code Here

            return null;
       
        Collection<InterfaceType> superInterfaces = _implDecl.getSuperinterfaces();
        for (InterfaceType intfType : superInterfaces)
        {
            InterfaceDeclaration intfDecl = intfType.getDeclaration();
            if (intfDecl != null &&
                intfDecl.getAnnotation(org.apache.beehive.controls.api.bean.ControlInterface.class) != null)
                return new AptControlInterface(intfDecl, _ap);
        }

        return null;
    }
View Full Code Here

TOP

Related Classes of com.sun.mirror.declaration.InterfaceDeclaration

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.