Package com.laamella.javamodel

Examples of com.laamella.javamodel.JavaFile


        return model.baseName + "MapperTemplate";
    }

    @Override
  public void generate(Model model) throws Exception {
        final JavaFile file = new JavaFile(packageName, name(model));
        final ClassBody clas = file.class_("public abstract class %s extends %s", name(model), ReaderGenerator.name(model));
        for (Element element : model.topLevelElements) {
            createMethodsForElement(element, clas);
        }
        file.write(outputStreamFactory);
    }
View Full Code Here


        return model.baseName + "Mapper";
    }

    @Override
  public void generate(Model model) throws Exception {
        final JavaFile generatorFile = new JavaFile(packageName, name(model));
        generatorFile.imports.add(XMLStreamException.class);
        generatorFile.imports.add(XMLStreamReader.class);
        final ClassBody generatorClass = generatorFile.class_("public class %s extends %s", name(model), MapperTemplateGenerator.name(model));
        for (Element element : model.topLevelElements) {
            createMethodsForElement(element, generatorClass);
            createDocumentReader(element, generatorClass);
        }
        generatorFile.write(outputStreamFactory);
    }
View Full Code Here

        return model.baseName + "Reader";
    }

    @Override
  public void generate(Model model) throws Exception {
        final JavaFile file = new JavaFile(packageName, name(model));

        file.imports.addStatic(XMLStreamConstants.class);
        file.imports.add(javax.xml.namespace.QName.class);
        file.imports.add(XMLStreamException.class);
        file.imports.add(XMLStreamReader.class);
        final ClassBody clas = file.class_("public abstract class %s", file.name);

        for (Entry<String, String> ns : model.namespaceJavaNames.entrySet()) {
            clas.fields.add("public final static String %s=\"%s\";", ns.getValue(), ns.getKey());
        }
        for (Entry<QName, String> qName : model.qNameJavaNames.entrySet()) {
            String ns = model.namespaceJavaNames.get(qName.getKey().namespace);
            clas.fields.add("public final static QName %s=new QName(%s, \"%s\");", qName.getValue(), ns, qName.getKey().localPart);
        }

        for (final Element element : model.topLevelElements) {
            createReaderForDocument(element, clas);
        }

        for (JavaType type : model.javaTypes) {
            createTypeConverter(type, clas);
        }

        file.write(outputStreamFactory);
    }
View Full Code Here

    return model.baseName + "Mapper";
  }

  @Override
  public void generate(Model model) throws Exception {
    final JavaFile file = new JavaFile(packageName, name(model));
    final ClassBody clas = file.class_("public class %s extends %s", name(model), MapperTemplateGenerator.name(model));
    file.write(outputStreamFactory);
  }
View Full Code Here

    }
  }

  private void createModelForElement(Element element, Set<JavaFile> modelFiles) {
    if (element.complex) {
      final JavaFile modelFile = new JavaFile(packageName, element.fullyQualifiedName);
      modelFiles.add(modelFile);
      final ClassBody modelClass = modelFile.class_("public class %s", element.fullyQualifiedName);
      List<String> constructorArgs = new ArrayList<String>();

      for (Element child : element.children) {
        createModelForElement(child, modelFiles);
        createGetter(modelClass, child);
View Full Code Here

TOP

Related Classes of com.laamella.javamodel.JavaFile

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.