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

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


        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

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

        {
            validatorVersion = CompilerUtils.getEnumFieldName( ann, VALIDATOR_VERSION_ATTR, true );
        }
        else
        {
            TypeDeclaration outerType = null;

            if ( CompilerUtils.isJpfAnnotation( ann, ACTION_TAG_NAME ) )
            {
                outerType = CompilerUtils.getOuterClass( classMember );
            }
View Full Code Here

        if (memberDecl.getSimpleName().equals(TYPE_HINT_ATTR)) {
            // Strip off any template args, and compare the typeHint to the actual type.
            String typeHintStr = member.getValue().toString();
            int angleBracket = typeHintStr.indexOf('<');
            String strippedTypeHintStr = angleBracket != -1 ? typeHintStr.substring(0, angleBracket) : typeHintStr;
            TypeDeclaration typeHint = getEnv().getTypeDeclaration(strippedTypeHintStr);

            // Add a warning if the typeHint type can't be resolved.
            if (typeHint == null) {
                addWarning(member, "warning.type-hint-unresolvable", TYPE_HINT_ATTR, typeHintStr);
            } else {
View Full Code Here

        // Make sure it's a filetype that should exist on the filesystem.  If not, ignore it.
        //
        if ( ! checkAnyExtension() && ! isCheckableExtension( filePath ) ) return null;

        boolean fileExists = true;
        TypeDeclaration outerClass = CompilerUtils.getOutermostClass( classMember );
        File fileToCheck = null;

        if ( filePath.charAt( 0 ) == '/' // relative to webapp root
        {
            if ( _pathMustBeRelative ) addError( value, "error.relative-uri" );
           
            if ( filePath.endsWith( JPF_FILE_EXTENSION_DOT ) )
            {
                TypeDeclaration type = CompilerUtils.inferTypeFromPath( filePath, getEnv() );
                fileToCheck = type != null ? CompilerUtils.getSourceFile( type, false ) : null;
                if (fileToCheck == null || ! fileToCheck.exists()) {
                    fileExists = false;
                }
            }
View Full Code Here

                else {
                    normalized = true;
                }
            }
            className = ( pkg.length() > 0 ? pkg + '.' : "" ) + className.replace( '/', '.' );
            TypeDeclaration type = env.getTypeDeclaration( className );
            fileToCheck = type != null ? CompilerUtils.getSourceFile( type, false ) : null;
            if ( fileToCheck == null ) fileExists = false;
        }
        // In certain error conditions (jpfFile == null), we can't determine the file.  In this case, just ignore.
        else if ( CompilerUtils.getSourceFile( outerClass, false ) != null )
View Full Code Here

                           int annotationArrayIndex )
    {
        //
        // Look through all the methods to see if there is one whose name matches the given value.
        //
        TypeDeclaration outerType = CompilerUtils.getOuterClass( classMember );
        MethodDeclaration[] methods = CompilerUtils.getClassMethods( outerType, null );
        String methodName = ( String ) value.getValue();
       
        for ( int i = 0; i < methods.length; i++ )
        {
View Full Code Here

            // Make sure the current entity (class or action method) doesn't have two @Jpf.Catch annotations
            // that refer to methods with duplicate @Jpf.Forwards.
            //
            Collection catches =
                    CompilerUtils.getAnnotationArrayValue( classMember, _annotationRootName, CATCHES_ATTR, true );
            TypeDeclaration outerType = CompilerUtils.getOuterClass( classMember );
           
            if ( catches == null )
            {
                return;
            }
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.