All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.tsl2.nano.h5.annotation.ControllerAnnotationFactory Maven / Gradle / Ivy

Go to download

TSL2 Framework Html5 Extensions (WebServer, Html5Presentation, RuleCover, BeanConfigurator, LogicTable-Sheet, Expression-Descriptors for Actions, Rules, URLs, Queries)

There is a newer version: 2.5.2
Show newest version
package de.tsl2.nano.h5.annotation;

import java.io.Serializable;

import de.tsl2.nano.annotation.extension.AnnotationFactory;
import de.tsl2.nano.bean.def.BeanDefinition;
import de.tsl2.nano.h5.configuration.BeanConfigurator;

@SuppressWarnings({ "unchecked", "rawtypes" })
public class ControllerAnnotationFactory implements AnnotationFactory {

    @Override
    public void build(BeanDefinition instance, Controller a) {
        Class targetType = !isDefaultTargetType(a) ? a.targetType() : instance.getClazz();
        BeanConfigurator configurator = (BeanConfigurator) BeanConfigurator.create(instance.getClazz()).getInstance();
        configurator.createControllerBean(a.baseType().getName(), a.baseAttribute(), targetType.getName(), a.targetAttribute(), a.iconAttribute(),
            a.increaseAttribute(), a.increaseCount(), a.increaseStep(), a.showText(), a.transparent(), a.creationOnly());
    }

    private boolean isDefaultTargetType(Controller a) {
        return a.targetType().equals(Serializable.class);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy