Examples of InterfaceDeclaration


Examples of com.sun.mirror.declaration.InterfaceDeclaration

        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

Examples of com.sun.mirror.declaration.InterfaceDeclaration

            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

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

Examples of com.sun.mirror.declaration.InterfaceDeclaration

        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

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 = ControlUtils.resolveDefaultBinding( defBinding, controlIntf.getQualifiedName() );

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

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

Examples of com.sun.mirror.declaration.InterfaceDeclaration

         // 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

Examples of com.sun.mirror.declaration.InterfaceDeclaration

                // 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

Examples of com.sun.mirror.declaration.InterfaceDeclaration

     */
    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

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);
            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

Examples of com.sun.mirror.declaration.InterfaceDeclaration

        // 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
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.