Package com.sun.mirror.declaration

Examples of com.sun.mirror.declaration.InterfaceDeclaration


            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 = ControlBeanContext.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

        // 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.
            //
            /* todo: why does this happen?  in this case, the events from super @EventSet interfaces
                     won't be added to the event adapter which results in an incomplete
                     implementation of the event set interface.
            /*
            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;
        }

        InterfaceDeclaration superDecl = superType.getDeclaration();
        if ( superDecl != null )
        {
            if (superDecl.getAnnotation(ControlExtension.class) != null ||
                superDecl.getAnnotation(ControlInterface.class) != null)
            {
                _superDecl = superDecl;
                AptControlInterface superIntf = new AptControlInterface(_superDecl, _ap);

                if (!isExtension() && superIntf.isExtension())
View Full Code Here

        Vector<InterfaceDeclaration> checkIntfs = new Vector<InterfaceDeclaration>();
        checkIntfs.add(_intfDecl);

        for (int i = 0; i < checkIntfs.size(); i++)
        {
            InterfaceDeclaration intfDecl = checkIntfs.elementAt(i);
            if (intfDecl.equals(_superDecl))
                continue;

            if ( intfDecl.getMethods() == null )
                continue;

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

            if ( intfDecl.getSuperinterfaces() == null )
                continue;

            for (InterfaceType superType : intfDecl.getSuperinterfaces())
            {
                InterfaceDeclaration superDecl = superType.getDeclaration();
                if (superDecl != null && !checkIntfs.contains(superDecl))
                    checkIntfs.add(superDecl);
            }
        }
View Full Code Here

        AptControlInterface mostDerived = (AptControlInterface) getMostDerivedInterface();
        if ( mostDerived == null )
            return;

        InterfaceDeclaration intfDecl = mostDerived._intfDecl;

        if ( intfDecl == null )
            return;

        AnnotationMirror controlMirror = null;

        for (AnnotationMirror annot : intfDecl.getAnnotationMirrors())
        {
            if (annot.getAnnotationType().getDeclaration().getQualifiedName().equals(
                    "org.apache.beehive.controls.api.bean.ControlInterface"))
            {
                controlMirror = annot;
                break;
            }
        }

        assert ( controlMirror != null ) : "Found a control interface that isn't annotated properly: " + intfDecl;

        AptAnnotationHelper controlAnnot = new AptAnnotationHelper(controlMirror);

        //
        // Read the name of the checker class from the @ControlInterface annotation,
        // dynamically load and run it.
        //

        DeclaredType checkerMirror = (DeclaredType)controlAnnot.getObjectValue("checker");
        if ( checkerMirror == null )
        {
            // try the deprecated 'checkerClass' attribute
            checkerMirror = (DeclaredType)controlAnnot.getObjectValue("checkerClass");
        }

        if ( checkerMirror != null && checkerMirror.getDeclaration() != null )
        {
            // TODO: optimize to not invoke default checker?
            String checkerName = checkerMirror.toString();

            try
            {
                ClassLoader loader = getExternalClassLoader();

                Class checkerClass = loader.loadClass( checkerName );
                if ( !ControlChecker.class.isAssignableFrom(checkerClass) )
                {
                    _ap.printError( intfDecl, "control.interface.illegal.checker", intfDecl.getSimpleName(), checkerName );
                }
                else
                {

                    Constructor ctor = checkerClass.getConstructor();

                    ControlChecker checker = (ControlChecker) ctor.newInstance();
                    CheckerAnnotationProcessorEnvironmentImpl ape =
                            new CheckerAnnotationProcessorEnvironmentImpl(_ap);
                    checker.check( _intfDecl, ape );
                }
            }
            catch ( Exception e ) {
                _ap.printError( intfDecl, "control.interface.checker.load.failed", intfDecl.getSimpleName(), checkerName );
            }
        }
    }
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.