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

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


        //
        MethodDeclaration[] methods = CompilerUtils.getClassMethods( flowControllerClass, null );
       
        for ( int i = 0; i < methods.length; i++ )
        {
            MethodDeclaration method = methods[i];
            AnnotationInstance ann = CompilerUtils.getAnnotation( method, ACTION_TAG_NAME );
           
            if ( ann != null )
            {
                enableNavigateTo( CompilerUtils.getAnnotation( ann, VALIDATION_ERROR_FORWARD_ATTR, true ), fcInfo );
View Full Code Here


            // 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 );
               
                if ( ann != null )
                {
                    List methodForwards = CompilerUtils.getAnnotationArray( ann, FORWARDS_ATTR, true );
                    String methodName = method.getSimpleName();
                   
                    if ( methodForwards != null )
                    {
                        for ( Iterator j = methodForwards.iterator(); j.hasNext(); )
                        {
View Full Code Here

            // For each method, add the @Jpf.CommandHandler annotation.
            MethodDeclaration[] methods = CompilerUtils.getClassMethods( publicClass, COMMAND_HANDLER_TAG_NAME );
            for ( int i = 0; i < methods.length; i++ )
            {
                MethodDeclaration method = methods[i];
                AnnotationInstance commandHandlerAnn = CompilerUtils.getAnnotation( method, COMMAND_HANDLER_TAG_NAME );
                atx.include( method, commandHandlerAnn );
            }

            // Add @Jpf.SharedFlowField, @Jpf.PageFlowField, @Control.
View Full Code Here

        String thisMethodName = classMember.getSimpleName();
        MethodDeclaration[] classMethods = CompilerUtils.getClassMethods( outerType, EXCEPTION_HANDLER_TAG_NAME );
       
        for ( int i = 0; i < classMethods.length; i++ )
        {
            MethodDeclaration method = classMethods[i];
           
            if ( ! method.equals( classMember ) && method.getSimpleName().equals( thisMethodName ) )
            {
                addError( annotation, "error.duplicate-exception-handler" );
            }
        }
View Full Code Here

                    new CommandHandlerGrammar( getEnv(), getDiagnostics(), getRuntimeVersionChecker(), jpfClass, fcInfo );
            MethodDeclaration[] methods = CompilerUtils.getClassMethods( jclass, COMMAND_HANDLER_TAG_NAME );
   
            for ( int i = 0; i < methods.length; i++ )
            {
                MethodDeclaration method = methods[i];
                getFBSourceFileInfo().addCommandHandler( method.getSimpleName() );
                chg.check( CompilerUtils.getAnnotation( method, COMMAND_HANDLER_TAG_NAME ), null, method );
            }
           
            Map checkResultMap = new HashMap();
            checkResultMap.put( JpfLanguageConstants.ExtraInfoKeys.facesBackingInfo, getSourceFileInfo() );
View Full Code Here

    {
        MethodDeclaration[] actionMethods = CompilerUtils.getClassMethods( _jclass, ACTION_TAG_NAME );
       
        for ( int i = 0; i < actionMethods.length; i++ )
        {
            MethodDeclaration actionMethod = actionMethods[i];
           
            if ( ! actionMethod.hasModifier( Modifier.ABSTRACT ) )
            {
                // If this is an inherited method, add a delegating action mapping.
                TypeDeclaration declaringType = actionMethod.getDeclaringType();
                if (CompilerUtils.typesAreEqual(_jclass, declaringType)) {
                    addActionMapping(new GenActionModel(actionMethod, this, _jclass));
                } else {
                    addActionMapping(new DelegatingActionModel(actionMethod, declaringType, this, _jclass));
                }
View Full Code Here

            //
            MethodDeclaration[] methods = classDecl.getMethods();
           
            for ( int i = 0; i < methods.length; i++ )
            {
                MethodDeclaration method = methods[i];
                if ( method.getSimpleName().equals( actionName )
                     && CompilerUtils.getAnnotation( method, ACTION_TAG_NAME ) != null )
                {
                    return true;
                }
            }
View Full Code Here

                    {
                        MethodDeclaration[] allMethods = CompilerUtils.getClassMethods( outerType, null );
                       
                        for ( int i = 0; i < allMethods.length; i++ )
                        {
                            MethodDeclaration method = allMethods[i];
                            AnnotationInstance exHandlerAnnotation =
                                CompilerUtils.getAnnotation( method, EXCEPTION_HANDLER_TAG_NAME );
                           
                            if ( exHandlerAnnotation != null && method.getSimpleName().equals( methodName ) )
                            {
                                Collection forwardAnnotations =
                                        CompilerUtils.getAnnotationArray( exHandlerAnnotation, FORWARDS_ATTR, false );
                               
                                for ( Iterator i3 = forwardAnnotations.iterator(); i3.hasNext();
View Full Code Here

            else if (decl instanceof MethodDeclaration) {
                //
                // Declarative validation annotations on a method. Include as a
                // possible form bean that does not have the @FormBean annotation.
                //
                MethodDeclaration methodDecl = (MethodDeclaration) decl;
                TypeDeclaration type = methodDecl.getDeclaringType();
                if (type instanceof ClassDeclaration) {
                    ClassDeclaration jclass = (ClassDeclaration) type;
                    if (!classNames.contains(jclass.getQualifiedName())) {
                        classNames.add(jclass.getQualifiedName());
                        classDecls.add(jclass);
View Full Code Here

        // a form bean class, even if it's not annotated as such.
        MethodDeclaration[] methods = CompilerUtils.getClassMethods( jclass, null );
       
        for ( int i = 0; i < methods.length; i++ )
        {
            MethodDeclaration method = methods[i];
            isFormBeanClass |=
                checkValidationAnnotation( method, VALIDATABLE_PROPERTY_TAG_NAME, validatablePropertyGrammar );
            // We don't currently support validation rule annotations directly on getter methods.
            /*
            hasOne |= checkValidationAnnotation( method, LOCALE_RULES_ATTR, _validationLocaleRulesGrammar );
            hasOne |= checkValidationAnnotation( method, VALIDATE_REQUIRED_TAG_NAME, _baseValidationRuleGrammar );
            hasOne |= checkValidationAnnotation( method, VALIDATE_RANGE_TAG_NAME, _validateRangeGrammar );
            hasOne |= checkValidationAnnotation( method, VALIDATE_MIN_LENGTH_TAG_NAME, _baseValidationRuleGrammar );
            hasOne |= checkValidationAnnotation( method, VALIDATE_MAX_LENGTH_TAG_NAME, _baseValidationRuleGrammar );
            hasOne |= checkValidationAnnotation( method, VALIDATE_CREDIT_CARD_TAG_NAME, _baseValidationRuleGrammar );
            hasOne |= checkValidationAnnotation( method, VALIDATE_EMAIL_TAG_NAME, _baseValidationRuleGrammar );
            hasOne |= checkValidationAnnotation( method, VALIDATE_MASK_TAG_NAME, _baseValidationRuleGrammar );
            hasOne |= checkValidationAnnotation( method, VALIDATE_DATE_TAG_NAME, _baseValidationRuleGrammar );
            hasOne |= checkValidationAnnotation( method, VALIDATE_TYPE_TAG_NAME, _validateTypeGrammar );
            */
        }
       
        CoreAnnotationProcessorEnv env = getEnv();
       
        // Make sure ActionForm subclasses are public static, and that they have default constructors.
        if ( isFormBeanClass || CompilerUtils.isAssignableFrom( STRUTS_FORM_CLASS_NAME, jclass, env ) )
        {
            if ( jclass.getDeclaringType() != null && ! jclass.hasModifier( Modifier.STATIC ) )
            {
                getDiagnostics().addError( jclass, "error.form-not-static" );
            }
           
            if ( ! jclass.hasModifier( Modifier.PUBLIC ) )
            {
                getDiagnostics().addError( jclass, "error.form-not-public" );
            }
           
            if ( ! CompilerUtils.hasDefaultConstructor( jclass ) )
            {
               getDiagnostics().addError( jclass, "error.form-no-default-constructor" );
            }
        }

        // check that a class with declarative validation  uses a FormBean annotation
        if (isFormBeanClass && !hasFormBeanAnnotation) {
            getDiagnostics().addWarning(jclass, "warning.validatable-formbean-use-formbean",
                                        ANNOTATION_INTERFACE_PREFIX + FORM_BEAN_TAG_NAME);
        }
       
        // Check to see if this class extends the (deprecated) FormData class and overrides its validate() method.
        // If so, then declarative validation annotations won't work unless the override calls super.validate().
        // Print a warning describing this behavior and suggesting implementing Validatable instead.
        methods = jclass.getMethods();
        if (CompilerUtils.isAssignableFrom(PAGEFLOW_FORM_CLASS_NAME, jclass, env)) {
            for (int i = 0; i < methods.length; i++) {
               
                MethodDeclaration method = methods[i];
                if (method.getSimpleName().equals("validate")) {
                    ParameterDeclaration[] params = method.getParameters();
                   
                    if (params.length == 2) {
                        TypeInstance param1Type = params[0].getType();
                        TypeInstance param2Type = params[1].getType();
                       
View Full Code Here

TOP

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

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.