Package com.sun.codemodel

Examples of com.sun.codemodel.JCodeModel


    };

    Options options = new Options();
    options.parseArguments(arguments);
    ConsoleErrorReporter receiver = new ConsoleErrorReporter();
    Model model = ModelLoader.load(options, new JCodeModel(), receiver);
    model.generateCode(options, receiver);
    com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
    model.codeModel.build(cw);
  }
View Full Code Here


    };

    Options options = new Options();
    options.parseArguments(arguments);
    ConsoleErrorReporter receiver = new ConsoleErrorReporter();
    Model model = ModelLoader.load(options, new JCodeModel(), receiver);
    model.generateCode(options, receiver);
    com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
    model.codeModel.build(cw);
  }
View Full Code Here

        compiler.setErrorListener(elForRun);

        addSchemas(wsdlUrl, schemas, compiler);
       
        S2JJAXBModel intermediateModel = compiler.bind();
        JCodeModel codeModel = intermediateModel.generateCode(null, elForRun);
        StringBuilder sb = new StringBuilder();
        boolean firstnt = false;

        for (Iterator<JPackage> packages = codeModel.packages(); packages.hasNext();) {
            JPackage jpackage = packages.next();
            String name = jpackage.name();
            if ("org.w3._2001.xmlschema".equals(name)
                || !jpackage.classes().hasNext()) {
                continue;
            }
            if (firstnt) {
                sb.append(':');
            } else {
                firstnt = true;
            }
            sb.append(jpackage.name());
        }
        outputDebug(codeModel);
       
        String packageList = sb.toString();

        // our hashcode + timestamp ought to be enough.
        String stem = toString() + "-" + System.currentTimeMillis();
        File src = new File(tmpdir, stem + "-src");
        if (!src.mkdir()) {
            throw new IllegalStateException("Unable to create working directory " + src.getPath());
        }
        try {
            FileCodeWriter writer = new FileCodeWriter(src);
            codeModel.build(writer);
        } catch (IOException e) {
            throw new IllegalStateException("Unable to write generated Java files for schemas: "
                                            + e.getMessage(), e);
        }
        File classes = new File(tmpdir, stem + "-classes");
View Full Code Here

                ClassCollector classCollector = context.get(ClassCollector.class);
                for (JClass cls : schem2JavaJaxbModel.getAllObjectFactories()) {
                    classCollector.getTypesPackages().add(cls._package().name());
                }

                JCodeModel jcodeModel = schem2JavaJaxbModel.generateCode(null, null);

                if (!isSuppressCodeGen()) {
                    jcodeModel.build(fileCodeWriter);
                }

                context.put(JCodeModel.class, jcodeModel);

                for (String str : fileCodeWriter.getExcludeFileList()) {
View Full Code Here

      for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) {
        if (fieldOutline instanceof FieldOutline) {
          final CPropertyInfo property = fieldOutline.getPropertyInfo();

          final JCodeModel codeModel = classOutline.parent().getCodeModel();

          final JFieldVar currentField = implClass.fields().get(property.getName(false));

          // LOG.info("fieldType: " + currentField.name());
          // find the common type
View Full Code Here

                ClassCollector classCollector = context.get(ClassCollector.class);
                for (JClass cls : schem2JavaJaxbModel.getAllObjectFactories()) {
                    classCollector.getTypesPackages().add(cls._package().name());
                }

                JCodeModel jcodeModel = schem2JavaJaxbModel.generateCode(null, null);

                if (!isSuppressCodeGen()) {
                    jcodeModel.build(fileCodeWriter);
                }

                context.put(JCodeModel.class, jcodeModel);

                for (String str : fileCodeWriter.getExcludeFileList()) {
View Full Code Here

                ClassCollector classCollector = context.get(ClassCollector.class);
                for (JClass cls : schem2JavaJaxbModel.getAllObjectFactories()) {
                    classCollector.getTypesPackages().add(cls._package().name());
                }

                JCodeModel jcodeModel = schem2JavaJaxbModel.generateCode(null, null);

                if (!isSuppressCodeGen()) {
                    jcodeModel.build(fileCodeWriter);
                }

                context.put(JCodeModel.class, jcodeModel);

                for (String str : fileCodeWriter.getExcludeFileList()) {
View Full Code Here

                ClassCollector classCollector = context.get(ClassCollector.class);
                for (JClass cls : schem2JavaJaxbModel.getAllObjectFactories()) {
                    classCollector.getTypesPackages().add(cls._package().name());
                }

                JCodeModel jcodeModel = schem2JavaJaxbModel.generateCode(null, null);

                if (!isSuppressCodeGen()) {
                    jcodeModel.build(fileCodeWriter);
                }

                context.put(JCodeModel.class, jcodeModel);

                for (String str : fileCodeWriter.getExcludeFileList()) {
View Full Code Here

                ClassCollector classCollector = context.get(ClassCollector.class);
                for (JClass cls : schem2JavaJaxbModel.getAllObjectFactories()) {
                    classCollector.getTypesPackages().add(cls._package().name());
                }

                JCodeModel jcodeModel = schem2JavaJaxbModel.generateCode(null, null);

                if (!isSuppressCodeGen()) {
                    jcodeModel.build(fileCodeWriter);
                }

                context.put(JCodeModel.class, jcodeModel);

                for (String str : fileCodeWriter.getExcludeFileList()) {
View Full Code Here

    this.mappings = mappingSet;
    this.className = "Gen" + classCreator.incrementAndGet();
    this.fqcn = packageName + "." + className;
    try{
      this.definition = definition;
      this.model = new JCodeModel();
      this.clazz = model._package(packageName)._class(className);
      blocks = (LinkedList<JBlock>[]) new LinkedList[sig.size()];
      for(int i =0; i < sig.size(); i++){
        blocks[i] = Lists.newLinkedList();
      }
View Full Code Here

TOP

Related Classes of com.sun.codemodel.JCodeModel

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.