Package net.flexmojos.oss.generator

Examples of net.flexmojos.oss.generator.GenerationException


    {
      // add / create package translators
      for(String currentTranslator : request.getTranslators()){
        String[] splitTranslator = currentTranslator.split("=");
        if(splitTranslator.length != 2){
          throw new GenerationException("Invalid format: translators must be in format 'java.package=as3.package'");
        }
        String java = splitTranslator[0];
        String as3 = splitTranslator[1];
       
        getLogger().info("Adding translator: [" + java + ", " + as3 + "]");
View Full Code Here


                }
            }
            catch ( Exception e )
            {
                getLogger().error( getStackTrace( e ) );
                throw new GenerationException( "Fail to generate class [" + className + "]", e );
            }
        }
        return count;
    }
View Full Code Here

        {
            return (T) loader.loadClass( className ).newInstance();
        }
        catch ( Exception e )
        {
            throw new GenerationException( "Instantiate [" + className + "] failed." );
        }
    }
View Full Code Here

        throws GenerationException
    {
        Map<String, File> classes = request.getClasses();
        if ( !classes.containsKey( THREAD_LOCAL_TOOLKIT ) )
        {
            throw new GenerationException( "Class not found: " + THREAD_LOCAL_TOOLKIT );
        }

        try
        {
            instrumentThreadLocalToolkit( classes.get( THREAD_LOCAL_TOOLKIT ), request.getTransientOutputFolder() );
        }
        catch ( IOException e )
        {
            throw new GenerationException( "Failed to generated wrapper " + THREAD_LOCAL_TOOLKIT, e );
        }
    }
View Full Code Here

            {
                clazz = request.getClassLoader().loadClass( classname );
            }
            catch ( ClassNotFoundException e )
            {
                throw new GenerationException( e.getMessage(), e );
            }

            List<Field> fieldsToGenerate = new ArrayList<Field>();

            Field[] fields = clazz.getFields();
            for ( Field field : fields )
            {
                if ( isPublic( field.getModifiers() ) && isStatic( field.getModifiers() )
                    && isFinal( field.getModifiers() ) && isPrimitive( field.getType() ) )
                {
                    fieldsToGenerate.add( field );
                }
            }

            if ( fieldsToGenerate.isEmpty() )
            {
                continue;
            }

            File outDir = request.getTransientOutputFolder();
            outDir = new File( outDir, clazz.getPackage().getName().replace( '.', '/' ) );
            outDir.mkdirs();

            File outFile = new File( outDir, clazz.getSimpleName() + ".as" );

            FileWriter fw;
            try
            {
                fw = new FileWriter( outFile );
                fw.append( "package " ).append( clazz.getPackage().getName() ).append( '{' ).append( '\n' );
                fw.append( "public class " ).append( clazz.getSimpleName() ).append( '{' ).append( '\n' );
                for ( Field field : fieldsToGenerate )
                {
                    fw.append( "public static const " ).append( field.getName() ).append( ':' );
                    fw.append( getAsType( field.getType() ) ).append( '=' );
                    fw.append( toString( field.get( clazz.newInstance() ) ) ).append( ';' ).append( '\n' );
                }
                fw.append( '}' ).append( '\n' );
                fw.append( '}' ).append( '\n' );

                fw.flush();

                fw.close();
            }
            catch ( Exception e )
            {
                throw new GenerationException( "Error generating " + clazz.getName(), e );
            }
        }
    }
View Full Code Here

     
      // add / create package translators
      for(String currentTranslator : request.getTranslators()){
        String[] splitTranslator = currentTranslator.split("=");
        if(splitTranslator.length != 2){
          throw new GenerationException("Invalid format: translators must be in format 'java.package=as3.package'");
        }
        String java = splitTranslator[0];
        String as3 = splitTranslator[1];
       
        getLogger().info("Adding translator: [" + java + ", " + as3 + "]");
View Full Code Here

                }
            }
            catch ( Exception e )
            {
                getLogger().error( getStackTrace( e ) );
                throw new GenerationException( "Fail to generate class [" + className + "]", e );
            }
        }
        return count;
    }
View Full Code Here

        {
            return (T) loader.loadClass( className ).newInstance();
        }
        catch ( Exception e )
        {
            throw new GenerationException( "Instantiate [" + className + "] failed." );
        }
    }
View Full Code Here

            {
                clazz = request.getClassLoader().loadClass( classname );
            }
            catch ( ClassNotFoundException e )
            {
                throw new GenerationException( e.getMessage(), e );
            }

            getMethods( clazz, factory, ann, arg );

            File outDir = request.getTransientOutputFolder();
            outDir.mkdirs();

            try
            {
                factory.write( outDir );
            }
            catch ( Exception e )
            {
                throw new GenerationException( "Error generating " + clazz.getName(), e );
            }
        }
    }
View Full Code Here

                            f.setAccessible( true );
                            argnames = f.get( info );
                        }
                        catch ( Exception e )
                        {
                            throw new GenerationException( e.getMessage(), e );
                        }
                        if ( argnames != null && argnames.getClass().isArray() && ( (Object[]) argnames ).length != 1 )
                        {
                            type = generateSubclass( factory, arg, info, name, ( (Object[]) argnames ).length );
                        }
View Full Code Here

TOP

Related Classes of net.flexmojos.oss.generator.GenerationException

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.