Search in sources :

Example 1 with M2MModel

use of com.abubusoft.kripton.processor.bind.model.many2many.M2MModel in project kripton by xcesco.

the class BindMany2ManySubProcessor method process.

@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    try {
        model = new M2MModel();
        for (Element daoItem : roundEnv.getElementsAnnotatedWith(BindDaoMany2Many.class)) {
            if (daoItem.getKind() != ElementKind.INTERFACE) {
                String msg = String.format("%s %s, only interface can be annotated with @%s annotation", daoItem.getKind(), daoItem, BindDaoMany2Many.class.getSimpleName());
                throw (new InvalidKindForAnnotationException(msg));
            }
            M2MEntity entity = M2MEntity.extractEntityManagedByDAO((TypeElement) daoItem);
            model.entityAdd(entity);
        }
        result = BindM2MBuilder.generate(filer, model);
    } catch (Exception e) {
        String msg = e.getMessage();
        error(null, msg);
        if (DEBUG_MODE) {
            logger.log(Level.SEVERE, msg);
            e.printStackTrace();
        }
    }
    return true;
}
Also used : BindDaoMany2Many(com.abubusoft.kripton.android.annotation.BindDaoMany2Many) Element(javax.lang.model.element.Element) TypeElement(javax.lang.model.element.TypeElement) GeneratedTypeElement(com.abubusoft.kripton.processor.element.GeneratedTypeElement) M2MModel(com.abubusoft.kripton.processor.bind.model.many2many.M2MModel) M2MEntity(com.abubusoft.kripton.processor.bind.model.many2many.M2MEntity) InvalidKindForAnnotationException(com.abubusoft.kripton.processor.exceptions.InvalidKindForAnnotationException) InvalidKindForAnnotationException(com.abubusoft.kripton.processor.exceptions.InvalidKindForAnnotationException)

Aggregations

BindDaoMany2Many (com.abubusoft.kripton.android.annotation.BindDaoMany2Many)1 M2MEntity (com.abubusoft.kripton.processor.bind.model.many2many.M2MEntity)1 M2MModel (com.abubusoft.kripton.processor.bind.model.many2many.M2MModel)1 GeneratedTypeElement (com.abubusoft.kripton.processor.element.GeneratedTypeElement)1 InvalidKindForAnnotationException (com.abubusoft.kripton.processor.exceptions.InvalidKindForAnnotationException)1 Element (javax.lang.model.element.Element)1 TypeElement (javax.lang.model.element.TypeElement)1