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

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


                    {
                        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


        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

     * @return a result (any Object) that will be passed back to the parent checker.  May be null</code>.
     */
    protected Object onEndCheck( AnnotationInstance annotation, AnnotationInstance[] parentAnnotations,
                                 MemberDeclaration classMember, Map checkResults )
    {
        MethodDeclaration handlerMethod = ( MethodDeclaration ) checkResults.get( METHOD_ATTR );
        DeclaredType exceptionType = ( DeclaredType ) checkResults.get( TYPE_ATTR );
       
        //
        // If either of these are null, then there was another already-reported error (e.g., type was unresolved).
        //
        if ( handlerMethod == null || exceptionType == null )
        {
            return null;
        }
       
        //
        // Make sure the given handler method can catch the right kind of exception.
        //
        ParameterDeclaration[] parameters = handlerMethod.getParameters();
               
        //
        // If the method's arguments are wrong in any way, don't worry about it -- the exception-handler checker will
        // report an error.
        //
        if ( parameters.length > 0 )
        {
            TypeInstance handledExceptionType = parameters[0].getType();
           
            if ( ! CompilerUtils.isAssignableFrom( handledExceptionType, CompilerUtils.getDeclaration( exceptionType ) ) )
            {
                addError( annotation, "error.incompatible-exception-handler", handlerMethod.getSimpleName(),
                          CompilerUtils.getDeclaration( exceptionType ).getQualifiedName() );
            }
        }

        return null;
View Full Code Here

                //
                String methodName = CompilerUtils.getString( catchAnnotation, METHOD_ATTR, false );
           
                if ( methodName.length() > 0 && ! methodName.equals( methodBeingChecked.getSimpleName() ) )
                {
                    MethodDeclaration otherMethod = findMethod( methodName, outerType );
                   
                    if ( otherMethod != null )
                    {
                        //
                        // Look through this other method's forwards.  None may have the same name (and different path)
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 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

        Collection properties = CompilerUtils.getBeanProperties( beanClass, true );
       
        for ( Iterator ii = properties.iterator(); ii.hasNext();
        {
            CompilerUtils.BeanPropertyDeclaration property = ( CompilerUtils.BeanPropertyDeclaration ) ii.next();
            MethodDeclaration getter = property.getGetter();
            String propertyName = property.getPropertyName();
           
            if ( getter != null )
            {
                //
                // Parse validation annotations on each getter.
                //
                AnnotationInstance[] annotations = getter.getAnnotationInstances();
               
                if ( annotations != null )
                {
                    List formNames = getFormBeanNames( beanClass );
                   
View Full Code Here

    {
        MethodDeclaration[] methods = CompilerUtils.getClassMethods( jclass, ACTION_TAG_NAME );
       
        for ( int i = 0; i < methods.length; i++ )
        {
            MethodDeclaration method = methods[i];
            AnnotationInstance actionAnnotation = CompilerUtils.getAnnotation( method, ACTION_TAG_NAME );
            assert actionAnnotation != null;
            addRulesFromActionAnnotation( actionAnnotation, method.getSimpleName() );
           
            ParameterDeclaration[] parameters = method.getParameters();
            if ( parameters.length > 0 )
            {
                TypeInstance type = parameters[0].getType();
               
                if ( type instanceof ClassType )
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

        // forwards, as appropriate.
        //
        if ( methodName != null )
        {
            setHandlerMethod( methodName );
            MethodDeclaration method = CompilerUtils.getClassMethod( jclass, methodName, EXCEPTION_HANDLER_TAG_NAME );
            AnnotationInstance exHandlerAnnotation = CompilerUtils.getAnnotation( method, EXCEPTION_HANDLER_TAG_NAME );
            GenForwardModel.addForwards( exHandlerAnnotation, forwardContainer, jclass, parentApp,
                                         " from exception-handler " + methodName )// @TODO I18N the comment
                   
            //
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).
            //
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.