Package org.apache.beehive.netui.compiler.typesystem.declaration

Examples of org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration


                String name = CompilerUtils.getString( sharedFlowRef, NAME_ATTR, true );
                TypeInstance type = CompilerUtils.getTypeInstance( sharedFlowRef, TYPE_ATTR, true );
               
                if ( type instanceof DeclaredType )   // if it's not a DeclaredType, the error will be caught elsewhere.
                {
                    TypeDeclaration typeDecl = ( ( DeclaredType ) type ).getDeclaration();
                   
                    if ( typeDecl != null )     // If the declaration is null, it's an error type.
                    {
                        _sharedFlowTypes.put( name, typeDecl );
                    }
                }
            }
        }
       
        //
        // If there's no SharedFlowController, fall back to the deprecated Global.app.
        //
        if ( _sharedFlowTypes.isEmpty() )
        {
            TypeDeclaration type = env.getTypeDeclaration( GLOBALAPP_FULL_CLASSNAME );
            if ( type != null ) _sharedFlowTypes.put( GLOBALAPP_SHARED_FLOW_NAME, type );
        }
 
        _sharedFlowTypeNames = new LinkedHashMap();
        _sharedFlowFiles = new LinkedHashMap();
       
        for ( Iterator i = _sharedFlowTypes.entrySet().iterator(); i.hasNext();
        {
            Map.Entry entry = ( Map.Entry ) i.next();
            TypeDeclaration type = ( TypeDeclaration ) entry.getValue();
            _sharedFlowTypeNames.put( entry.getKey(), type.getQualifiedName() );
            File file = CompilerUtils.getSourceFile( type, false );
           
            if ( file != null )
            {
                _sharedFlowFiles.put( entry.getKey(), file );
View Full Code Here


   
    protected String addFormBean( TypeInstance paramType, GenStrutsApp parentApp )
    {
        paramType = CompilerUtils.getGenericBoundsType( paramType );
        assert paramType instanceof DeclaredType : paramType.getClass().getName()// checker should enforce this
        TypeDeclaration decl = CompilerUtils.getDeclaration( ( DeclaredType ) paramType );
        List formBeans = parentApp.getMatchingFormBeans( decl, getFormMember() != null );
        assert formBeans.size() > 0;
        FormBeanModel formBeanModel = (FormBeanModel) formBeans.get(0);
        setFormBeanMessageResourcesKey(formBeanModel.getFormBeanMessageResourcesKey());
       
View Full Code Here

                    if (params.length == 2) {
                        TypeInstance param1Type = params[0].getType();
                        TypeInstance param2Type = params[1].getType();
                       
                        if (param1Type instanceof DeclaredType && param2Type instanceof DeclaredType) {
                            TypeDeclaration param1Decl = ((DeclaredType) param1Type).getDeclaration();
                            TypeDeclaration param2Decl = ((DeclaredType) param2Type).getDeclaration();
                            TypeDeclaration actionMappingDecl = env.getTypeDeclaration(STRUTS_ACTION_MAPPING_CLASS_NAME);
                            TypeDeclaration httpRequestDecl = env.getTypeDeclaration(HTTP_REQUEST_CLASS_NAME);
                           
                            if (param1Decl != null && CompilerUtils.typesAreEqual(param1Decl, actionMappingDecl)
                                && param2Decl != null && CompilerUtils.typesAreEqual(param2Decl, httpRequestDecl)) {
                                    getDiagnostics().addWarning(method, "warning.formdata-override-validate",
                                                                jclass.getQualifiedName(), PAGEFLOW_FORM_CLASS_NAME,
View Full Code Here

        //
        Collection innerTypes = CompilerUtils.getClassNestedTypes( jclass );
       
        for ( Iterator ii = innerTypes.iterator(); ii.hasNext();
        {
            TypeDeclaration innerType = ( TypeDeclaration ) ii.next();
            if ( innerType instanceof ClassDeclaration
                 && innerType.hasModifier( Modifier.PUBLIC )
                 && innerType.hasModifier( Modifier.STATIC ) )
            {
                addRulesFromBeanClass( ( ClassDeclaration ) innerType );
            }
        }
    }
View Full Code Here

        if ( catches != null )
        {
            for ( Iterator i = catches.iterator(); i.hasNext();
            {
                AnnotationInstance ann = ( AnnotationInstance ) i.next();
                TypeDeclaration containingType = ann.getContainingType();
               
                // If this is an inherited exception-catch, add a delegating exception config.
                if (CompilerUtils.typesAreEqual(containingType, jclass)) {
                    container.addException(new GenExceptionModel(strutsApp, ann, jclass, forwardContainer));
                } else {
View Full Code Here

                if ( ! CompilerUtils.isAbsoluteURL( path ) )
                {
                    path = '/' + path;

                    // See if we should be using the path for the struts module that this forward is relative to
                    TypeDeclaration typeDeclaration = annotation.getContainingType();

                    if ( ! typeDeclaration.equals( jclass ) && ! path.endsWith( ACTION_EXTENSION_DOT )
                            && parent.getFlowControllerInfo().getMergedControllerAnnotation().isInheritLocalPaths() )
                    {
                        setRelativeTo( CompilerUtils.inferModulePathFromType( typeDeclaration ) );
                    }
                }
View Full Code Here

        MethodDeclaration[] methods = CompilerUtils.getClassMethods( jclass, null );
       
        for ( int i = 0; i < methods.length; i++ )
        {
            MethodDeclaration method = methods[i];
            TypeDeclaration declaringType = method.getDeclaringType();
           
            //
            // Only add diagnostics if the method is in this class, or if it's inherited from a class that's *not* on
            // sourcepath (i.e., its SourcePosition is null).
            //
            if ( declaringType.equals( jclass ) || declaringType.getPosition() == null )
            {
                checkMethod( method, jclass, _actionGrammar, _exceptionHandlerGrammar );
            }
            else
            {
                //
                // We still want to run the checks, which aggregate information into the FlowControllerInfo.  We just
                // don't want diagnostics to be printed.
                //
                checkMethod( method, jclass, _actionGrammarSilentDiagnostics, _exceptionHandlerGrammarSilentDiagnostics );
            }
        }

        //
        // Check the inner classes.
        //
        Collection innerTypes = CompilerUtils.getClassNestedTypes( jclass );
       
        for ( Iterator ii = innerTypes.iterator(); ii.hasNext();
        {
            TypeDeclaration innerType = ( TypeDeclaration ) ii.next();
            if ( innerType instanceof ClassDeclaration ) checkInnerClass( ( ClassDeclaration ) innerType );
        }
       
        //
        // Run additional .jpf- or .app-specific checks.
        //
        doAdditionalClassChecks( jclass );
       
        //
        // Runtime performance enhancement: enable saving of previous-page and previous-action information based on
        // whether there were Forwards that contained navigateTo attributes.
        //
        enableNavigateTo( jclass, fcInfo.getMergedControllerAnnotation(), fcInfo );
        Map sharedFlowTypes = fcInfo.getSharedFlowTypes();
       
        if ( sharedFlowTypes != null )
        {
            for ( Iterator ii = sharedFlowTypes.values().iterator(); ii.hasNext();
            {
                TypeDeclaration sharedFlowType = ( TypeDeclaration ) ii.next();
                //
                // Saving of previous-page/previous-action info must be enabled if any of the referenced shared flows
                // use this feature.
                //
                enableNavigateTo( sharedFlowType, new MergedControllerAnnotation( sharedFlowType ), fcInfo );
View Full Code Here

    {
        for ( ClassType type = jclass.getSuperclass();
              type != null && CompilerUtils.isAssignableFrom( FLOWCONTROLLER_BASE_CLASS, type, getEnv() );
              type = type.getSuperclass() )
        {
            TypeDeclaration decl = CompilerUtils.getDeclaration( type );
           
            //
            // Check simple actions in the Controller annotation.
            //
            List simpleActions =
                    CompilerUtils.getAnnotationArrayValue( decl, CONTROLLER_TAG_NAME, SIMPLE_ACTIONS_ATTR, true );
           
            if ( simpleActions != null )
            {
                for ( Iterator j = simpleActions.iterator(); j.hasNext();
                {
                    AnnotationInstance i = ( AnnotationInstance ) j.next();
                    checkRelativePath( i, PATH_ATTR, jclass, decl, false );
                    List conditionalForwards = CompilerUtils.getAnnotationArray( i, CONDITIONAL_FORWARDS_ATTR, true );
                   
                    if ( conditionalForwards != null )
                    {
                        for ( Iterator k = conditionalForwards.iterator(); k.hasNext();
                        {
                            AnnotationInstance ann = ( AnnotationInstance ) k.next();
                            checkRelativePath( ann, PATH_ATTR, jclass, decl, false );
                        }
                    }
                }
            }
           
            //
            // Check Forwards in the Controller annotation.
            //
            List forwards = CompilerUtils.getAnnotationArrayValue( decl, CONTROLLER_TAG_NAME, FORWARDS_ATTR, true );
           
            if ( forwards != null )
            {
                for ( Iterator ii = forwards.iterator(); ii.hasNext();
                {
                    AnnotationInstance i = ( AnnotationInstance ) ii.next();
                    checkRelativePath( i, PATH_ATTR, jclass, decl, false );
                }
            }
           
            //
            // Check Catches in the Controller annotation.
            //
            List catches = CompilerUtils.getAnnotationArrayValue( decl, CONTROLLER_TAG_NAME, CATCHES_ATTR, true );
           
            if ( catches != null )
            {
                for ( Iterator j = catches.iterator(); j.hasNext();
                {
                    AnnotationInstance i = ( AnnotationInstance ) j.next();
                    checkRelativePath( i, PATH_ATTR, jclass, decl, false );
                }
            }

            //
            // Check strutsMerge and validatorMerge in the Controller annotation.
            //
            AnnotationInstance controllerAnnotation = CompilerUtils.getAnnotation( decl, CONTROLLER_TAG_NAME );

            if ( controllerAnnotation != null )
            {
                checkRelativePath( controllerAnnotation, VALIDATOR_MERGE_ATTR, jclass, decl, true );
                checkRelativePath( controllerAnnotation, STRUTSMERGE_ATTR, jclass, decl, true );
            }
           
            //
            // Check Forwards and Catches on action methods and exception-handler methods.
            //
            MethodDeclaration[] methods = decl.getMethods();
            for ( int i = 0; i < methods.length; i++ )
            {
                MethodDeclaration method = methods[i];
                AnnotationInstance ann = CompilerUtils.getAnnotation( method, ACTION_TAG_NAME);
                if ( ann == null ) ann = CompilerUtils.getAnnotation( method, EXCEPTION_HANDLER_TAG_NAME );
View Full Code Here

        {
            addWarning( annotation, "warning.annotated-abstract-method", null );
            return false;
        }
       
        TypeDeclaration outerType = CompilerUtils.getOuterClass( classMember );
        String thisMethodName = classMember.getSimpleName();
        MethodDeclaration[] classMethods = CompilerUtils.getClassMethods( outerType, EXCEPTION_HANDLER_TAG_NAME );
       
        for ( int i = 0; i < classMethods.length; i++ )
        {
View Full Code Here

                String name = CompilerUtils.getString( sharedFlowRef, NAME_ATTR, true );
                TypeInstance type = CompilerUtils.getTypeInstance( sharedFlowRef, TYPE_ATTR, true );
               
                if ( type instanceof DeclaredType )   // if it's not a DeclaredType, the error will be caught elsewhere.
                {
                    TypeDeclaration typeDecl = ( ( DeclaredType ) type ).getDeclaration();
                   
                    if ( typeDecl != null )     // If the declaration is null, it's an error type.
                    {
                        _sharedFlowTypes.put( name, typeDecl );
                    }
                }
            }
        }
       
        //
        // If there's no SharedFlowController, fall back to the deprecated Global.app.
        //
        if ( _sharedFlowTypes.isEmpty() )
        {
            TypeDeclaration type = env.getTypeDeclaration( GLOBALAPP_FULL_CLASSNAME );
            if ( type != null ) _sharedFlowTypes.put( GLOBALAPP_SHARED_FLOW_NAME, type );
        }
 
        _sharedFlowTypeNames = new LinkedHashMap();
        _sharedFlowFiles = new LinkedHashMap();
       
        for ( Iterator i = _sharedFlowTypes.entrySet().iterator(); i.hasNext();
        {
            Map.Entry entry = ( Map.Entry ) i.next();
            TypeDeclaration type = ( TypeDeclaration ) entry.getValue();
            _sharedFlowTypeNames.put( entry.getKey(), type.getQualifiedName() );
            File file = CompilerUtils.getSourceFile( type, false );
           
            if ( file != null )
            {
                _sharedFlowFiles.put( entry.getKey(), file );
View Full Code Here

TOP

Related Classes of org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration

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.