com.github.dennisit.vplus.html.vstrap.VplusHtmlBootstrap Maven / Gradle / Ivy
/*--------------------------------------------------------------------------
* Copyright (c) 2010-2020, Elon.su All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the elon developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Elon.su, you can also mail [email protected]
*--------------------------------------------------------------------------
*/
package com.github.dennisit.vplus.html.vstrap;
import com.github.dennisit.vplus.core.apis.impl.TemplateLoadApiImpl;
import com.github.dennisit.vplus.core.bean.VdbBean;
import com.github.dennisit.vplus.core.config.Vsetting;
import com.github.dennisit.vplus.core.parser.HTableClassNameParser;
import com.github.dennisit.vplus.core.parser.HTableClassTableParser;
import com.github.dennisit.vplus.core.utils.BornViewUtils;
import com.github.dennisit.vplus.html.plugin.VPlusHtmlBornApiImpl;
import org.apache.commons.lang3.StringUtils;
/**
* Created by Elon.su on 17/3/7.
*/
public class VplusHtmlBootstrap {
/**
* 扫描包,生成代码
* @param scanPackage
* @param bornPath
*/
public static void anoBorn(String scanPackage, String bornPath){
Vsetting vsetting = new Vsetting();
if(StringUtils.isNotBlank(scanPackage)){
vsetting.setScanPackage(scanPackage);
}
if(StringUtils.isNoneBlank(bornPath)){
vsetting.setBornPath(bornPath);
}
vsetting.setLocationPattern("classpath:/vplus-html/**");
anoBorn(vsetting);
}
/**
* 基于注解的扩展支持
* @param vsetting
*/
public static void anoBorn(Vsetting vsetting){
new VPlusHtmlBornApiImpl().vBorn(new HTableClassNameParser(), new TemplateLoadApiImpl(), vsetting);
BornViewUtils.open(vsetting.getBornPath());
}
/**
* 基于DB的扩展支持
* @param vdbBean
* @param bornPackage
*/
public static void dbBorn(VdbBean vdbBean, String bornPackage, String bornPath){
Vsetting vsetting = new Vsetting();
vsetting.setVdbBean(vdbBean);
if(StringUtils.isNotBlank(bornPackage)){
vsetting.setBornPackage(bornPackage);
}
if(StringUtils.isNoneBlank(bornPath)){
vsetting.setBornPath(bornPath);
}
vsetting.setLocationPattern("classpath:/vplus-html/**");
dbBorn(vsetting);
}
/**
* 基于DB的扩展支持
* @param vsetting
*/
public static void dbBorn(Vsetting vsetting){
new VPlusHtmlBornApiImpl().vBorn(new HTableClassTableParser(), new TemplateLoadApiImpl(), vsetting);
BornViewUtils.open(vsetting.getBornPath());
}
}