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

es.prodevelop.pui9.model.generator.layer.ServiceLayerGenerator Maven / Gradle / Ivy

There is a newer version: 1.18.0
Show newest version
package es.prodevelop.pui9.model.generator.layer;

import java.util.ArrayList;
import java.util.List;

import javax.tools.JavaFileObject;

import org.springframework.stereotype.Component;

import es.prodevelop.pui9.classpath.PuiClassLoaderUtils;
import es.prodevelop.pui9.model.generator.TemplateFileInfo;
import es.prodevelop.pui9.model.generator.layers.AbstractServiceLayerGenerator;
import es.prodevelop.pui9.service.interfaces.IService;

/**
 * This class represents the Service Layer Generator, to generate all the files
 * for the PUI Server.
 * 
 * @author Marc Gil - [email protected]
 */
@Component
public class ServiceLayerGenerator extends AbstractServiceLayerGenerator {

	@Override
	protected List> getClassesToRegister(List templateList) throws Exception {
		List> classes = new ArrayList<>();

		for (TemplateFileInfo tfi : templateList) {
			String className = (tfi.getPackageName() + "." + tfi.getFileName())
					.replace(JavaFileObject.Kind.SOURCE.extension, "");
			Class clazz = PuiClassLoaderUtils.getClassLoader().loadClass(className);
			if (IService.class.isAssignableFrom(clazz)) {
				if (!clazz.isInterface()) {
					classes.add(clazz);
				}
			}
		}

		return classes;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy