Search in sources :

Example 1 with DataSetPropertyInfo

use of org.robobinding.codegen.presentationmodel.DataSetPropertyInfo 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)

Example 2 with DataSetPropertyInfo

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

the class PresentationModelItemInfoProcessor method generateAllClasses.

@Override
protected void generateAllClasses(PresentationModelInfo presentationModelInfo, ProcessingContext context, Logger log) throws IOException, JClassAlreadyExistsException, ClassNotFoundException {
    DataSetPropertyInfo dataSetProperty = presentationModelInfo.dataSetProperties().toArray(new DataSetPropertyInfo[0])[0];
    WrappedTypeElement typeElement = context.typeElementOf(dataSetProperty.itemPresentationModelTypeName());
    PresentationModelInfoBuilder builder = new PresentationModelInfoBuilder(typeElement, dataSetProperty.itemPresentationModelObjectTypeName(), false);
    result = builder.build();
}
Also used : DataSetPropertyInfo(org.robobinding.codegen.presentationmodel.DataSetPropertyInfo) WrappedTypeElement(org.robobinding.codegen.apt.element.WrappedTypeElement)

Aggregations

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