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

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


        return true;
    }
   
    private static Object parseValue( AnnotationTypeElementDeclaration memberDecl, String strValue, SourcePositionImpl pos )
    {
        TypeInstance type = memberDecl.getReturnType();
   
        if ( type instanceof ClassType )
        {
            ClassType classType = ( ClassType ) type;
            String typeName = classType.getClassTypeDeclaration().getQualifiedName();
           
            if ( typeName.equals( "java.lang.String" ) )
            {
                return strValue;
            }
            else if ( typeName.equals( "java.lang.Class" ) )
            {
                TypeInstance retVal = XDocletCompilerUtils.resolveType( strValue, false, pos.getOuterClass() );
               
                if ( retVal == null )
                {
                    XDocletCompilerUtils.addError( pos, "error.unknown-class",
                                                   new String[]{ strValue, memberDecl.getSimpleName() } );
                }
               
                return XDocletCompilerUtils.resolveType( strValue, true, pos.getOuterClass() );
            }
            else
            {
                assert false : "unexpected type in annotation declaration: " + typeName;
            }
        }
        else if ( type instanceof ArrayType )
        {
            ArrayType arrayType = ( ArrayType ) type;
            TypeInstance componentType = arrayType.getComponentType();
           
            // We only handle an array of strings -- nothing else at this point.
            assert componentType instanceof DeclaredType : componentType.getClass().getName();
            assert ( ( DeclaredType ) componentType ).getDeclaration().getQualifiedName().equals( String.class.getName() )
                    : ( ( DeclaredType ) componentType ).getDeclaration().getQualifiedName();
            StringTokenizer tok = new StringTokenizer( strValue, "," );
            ArrayList arrayValues = new ArrayList();
            while ( tok.hasMoreTokens() )
View Full Code Here


                    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

            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

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

                ParameterDeclaration[] params = actionMethod.getParameters();
               
                if ( params.length > 0 )
                {
                    ParameterDeclaration param1 = params[0];
                    TypeInstance paramType = param1.getType();
                   
                    if ( paramType instanceof DeclaredType )
                    {
                        getMessageResourcesFromForm( CompilerUtils.getDeclaration( ( DeclaredType ) paramType ), actionModel );
                    }
View Full Code Here

        //
        // Only warn about nonserializable member data that's defined in this particular class.
        //
        if ( CompilerUtils.typesAreEqual( jclass, field.getDeclaringType() ) )
        {
            TypeInstance type = field.getType();
           
            if ( ! field.hasModifier( Modifier.TRANSIENT ) && ! field.hasModifier( Modifier.STATIC )
                 && type instanceof ClassType
                 && ! CompilerUtils.isAssignableFrom( SERIALIZABLE_CLASS_NAME, type, getEnv() ) )
            {
View Full Code Here

        // If this is a return-action, store its info in the FlowControllerInfo (which is eventually provided to tools).
        //
        if ( isReturnAction )
        {
            TypeDeclaration outerType = CompilerUtils.getOuterClass( classMember );
            TypeInstance formBeanType =
                    getFlowControllerInfo().addReturnAction( ( String ) value.getValue(), annotation, outerType );
           
            if ( formBeanType != null && ! ( formBeanType instanceof DeclaredType ) )
            {
                addError( annotation, "error.action-invalid-form-bean-type", formBeanType.toString() );
            }
        }
    }
View Full Code Here

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

            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

        // If this is a return-action, store its info in the FlowControllerInfo (which is eventually provided to tools).
        //
        if ( isReturnAction )
        {
            TypeDeclaration outerType = CompilerUtils.getOuterClass( classMember );
            TypeInstance formBeanType =
                    getFlowControllerInfo().addReturnAction( ( String ) value.getValue(), annotation, outerType );
           
            if ( formBeanType != null && ! ( formBeanType instanceof DeclaredType ) )
            {
                addError( annotation, "error.action-invalid-form-bean-type", formBeanType.toString() );
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.beehive.netui.compiler.typesystem.type.TypeInstance

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.