Search in sources :

Example 1 with ItemPresentationModelObjectClassGen

use of org.robobinding.codegen.presentationmodel.ItemPresentationModelObjectClassGen in project RoboBinding by RoboBinding.

the class PresentationModelProcessor method createItemPresentationModelObjectSourceFiles.

private void createItemPresentationModelObjectSourceFiles(PresentationModelInfo presentationModelInfo, ProcessingContext context) throws JClassAlreadyExistsException, IOException {
    for (DataSetPropertyInfo info : presentationModelInfo.dataSetProperties()) {
        if (processedItemPresentationModels.contains(info.itemPresentationModelTypeName())) {
            continue;
        }
        WrappedTypeElement typeElement = context.typeElementOf(info.itemPresentationModelTypeName());
        PresentationModelInfoBuilder builder = new PresentationModelInfoBuilder(typeElement, info.itemPresentationModelObjectTypeName(), true);
        PresentationModelInfo itemPresentationModelInfo = builder.build();
        Logger log = typeElement.logger();
        try {
            ItemPresentationModelObjectClassGen gen = new ItemPresentationModelObjectClassGen(itemPresentationModelInfo);
            run(gen);
            gen.writeTo(createOutput());
            log.info("ItemPresentationModel '" + itemPresentationModelInfo.getPresentationModelObjectTypeName() + "' generated.");
        } catch (java.lang.NoClassDefFoundError e) {
            RuntimeException error = new RuntimeException("an error occured when generating source code for '" + presentationModelInfo.getPresentationModelObjectTypeName() + "'", e);
            log.error(error);
            throw error;
        }
        processedItemPresentationModels.add(info.itemPresentationModelTypeName());
    }
}
Also used : PresentationModelInfo(org.robobinding.codegen.presentationmodel.PresentationModelInfo) DataSetPropertyInfo(org.robobinding.codegen.presentationmodel.DataSetPropertyInfo) WrappedTypeElement(org.robobinding.codegen.apt.element.WrappedTypeElement) ItemPresentationModelObjectClassGen(org.robobinding.codegen.presentationmodel.ItemPresentationModelObjectClassGen) Logger(org.robobinding.codegen.apt.Logger)

Aggregations

Logger (org.robobinding.codegen.apt.Logger)1 WrappedTypeElement (org.robobinding.codegen.apt.element.WrappedTypeElement)1 DataSetPropertyInfo (org.robobinding.codegen.presentationmodel.DataSetPropertyInfo)1 ItemPresentationModelObjectClassGen (org.robobinding.codegen.presentationmodel.ItemPresentationModelObjectClassGen)1 PresentationModelInfo (org.robobinding.codegen.presentationmodel.PresentationModelInfo)1