Examples of TypeInstance


Examples of org.apache.beehive.netui.compiler.typesystem.type.TypeInstance

         return false;
     }
   
    public static TypeInstance getArrayBaseType( ArrayType arrayType )
    {
        TypeInstance baseType = arrayType;
       
        do
        {
            baseType = ( ( ArrayType ) baseType ).getComponentType();
        } while ( baseType instanceof ArrayType );
View Full Code Here

Examples of org.apache.beehive.netui.compiler.typesystem.type.TypeInstance

            throws FatalCompileTimeException
    {
        //
        // First check the form bean type.
        //
        TypeInstance argType = getFormBeanType( annotation, classMember );
        TypeDeclaration argTypeDecl = null;
       
        if ( ! ( argType instanceof DeclaredType ) )
        {
            if ( argType != null )
            {
                getDiagnostics().addError( annotation, "error.action-invalid-form-bean-type", argType.toString() );
                argType = null;
            }
        }
        else
        {
            argTypeDecl = CompilerUtils.getDeclaration( ( DeclaredType ) argType );
            boolean isClass = argTypeDecl instanceof ClassDeclaration;
           
            if ( isClass && ! CompilerUtils.hasDefaultConstructor( argTypeDecl ) )
            {
                getDiagnostics().addError( annotation, "error.action-form-bean-no-default-constructor",
                                           argTypeDecl.getQualifiedName() );
            }
           
            if ( ! argTypeDecl.hasModifier( Modifier.PUBLIC ) )
            {
                getDiagnostics().addError( annotation, "error.action-form-bean-not-public",
                                           argTypeDecl.getQualifiedName() );
            }
           
            if ( isClass && argTypeDecl.getDeclaringType() != null && ! argTypeDecl.hasModifier( Modifier.STATIC ) )
            {
                getDiagnostics().addError( annotation, "error.action-form-bean-not-static",
                                           argTypeDecl.getQualifiedName() );
            }
           
            //
            // Give a warning if there is no validationErrorForward annotation and doValidation isn't set to false.
            //
            if ( CompilerUtils.getAnnotationValue( annotation, VALIDATION_ERROR_FORWARD_ATTR, true ) == null
                 && hasValidationAnnotations( argTypeDecl ) )
            {
                Boolean doValidation = CompilerUtils.getBoolean( annotation, DO_VALIDATION_ATTR, true );
               
                if ( doValidation == null || doValidation.booleanValue() )
                {
                    getDiagnostics().addWarning(
                            annotation, "warning.validatable-formbean-no-forward",
                            ANNOTATION_INTERFACE_PREFIX + annotation.getAnnotationType().getDeclaration().getSimpleName(),
                            VALIDATION_ERROR_FORWARD_ATTR, argTypeDecl.getQualifiedName() );
                }
            }
        }
       
        //
        // Add this action to the FlowControllerInfo.
        //
        getFlowControllerInfo().addAction( getActionName( annotation, classMember ),
                                           argTypeDecl != null ? argTypeDecl.getQualifiedName() : null );

        //
        // Check to make sure the 'useFormBean' attribute (reference to a member variable) matches the form declared as
        // an argument to the action method.
        //
        TypeInstance useFormBeanType = getUseFormBeanType( annotation, classMember );
       
        if ( useFormBeanType != null && useFormBeanType instanceof DeclaredType )
        {
            if ( argType == null )
            {
View Full Code Here

Examples of org.apache.beehive.netui.compiler.typesystem.type.TypeInstance

        // 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() );
View Full Code Here

Examples of org.apache.beehive.netui.compiler.typesystem.type.TypeInstance

                {
                    //
                    // Add a warning if this annotation is on a property getter of the same type, in which case the
                    // validation rule will never fail.
                    //
                    TypeInstance returnType = ( ( MethodDeclaration ) classMember ).getReturnType();
                   
                    if ( returnType instanceof PrimitiveType )
                    {
                        if ( ( ( PrimitiveType ) returnType ).getKind().equals( kind ) )
                        {
View Full Code Here

Examples of org.apache.beehive.netui.compiler.typesystem.type.TypeInstance

        {
            for ( Iterator i = sharedFlowRefs.iterator(); i.hasNext();
            {
                AnnotationInstance sharedFlowRef = ( AnnotationInstance ) i.next();
                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

Examples of org.apache.beehive.netui.compiler.typesystem.type.TypeInstance

     * Add a return-action from an annotation.
     * @return the form bean type, or null</code> if there is no form bean.
     */
    public TypeInstance addReturnAction( String returnActionName, AnnotationInstance annotation, TypeDeclaration outerType )
    {
        TypeInstance formBeanType = CompilerUtils.getTypeInstance( annotation, OUTPUT_FORM_BEAN_TYPE_ATTR, true );
       
        if ( formBeanType == null )
        {
            String memberFieldName = CompilerUtils.getString( annotation, OUTPUT_FORM_BEAN_ATTR, true );
           
View Full Code Here

Examples of org.apache.beehive.netui.compiler.typesystem.type.TypeInstance

        String formBeanName = null;
       
        if ( params.length > 0 )
        {
            assert params.length == 1 : params.length;  // checker should catch this
            TypeInstance paramType = CompilerUtils.getGenericBoundsType( params[0].getType() );
            formBeanName = addFormBean( paramType, parentApp );
        }
       
        return formBeanName;
    }
View Full Code Here

Examples of org.apache.beehive.netui.compiler.typesystem.type.TypeInstance

                    AnnotationInstance sharedFlowRef = ( AnnotationInstance ) ii.next();
                    if ( sharedFlowName.equals( CompilerUtils.getString( sharedFlowRef, NAME_ATTR, true ) ) )
                    {
                        foundOne = true;
                       
                        TypeInstance sfType = CompilerUtils.getTypeInstance( sharedFlowRef, TYPE_ATTR, true );
                        TypeInstance ft = field.getType();
                       
                        if ( ! ( sfType instanceof DeclaredType )
                             || ! CompilerUtils.isAssignableFrom( ft, ( ( DeclaredType ) sfType ).getDeclaration() ) )
                        {
                            getDiagnostics().addError(
View Full Code Here

Examples of org.apache.beehive.netui.compiler.typesystem.type.TypeInstance

                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();
                       
                        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);
View Full Code Here

Examples of org.apache.beehive.netui.compiler.typesystem.type.TypeInstance

            addRulesFromActionAnnotation( actionAnnotation, method.getSimpleName() );
           
            ParameterDeclaration[] parameters = method.getParameters();
            if ( parameters.length > 0 )
            {
                TypeInstance type = parameters[0].getType();
               
                if ( type instanceof ClassType )
                {
                    ClassDeclaration classDecl = ( ( ClassType ) type ).getClassTypeDeclaration();
                    if ( classDecl.getDeclaringType() == null ) addRulesFromBeanClass( classDecl );
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.