当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurationParser类代码示例

本文整理汇总了Java中org.mybatis.generator.config.xml.ConfigurationParser的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationParser类的具体用法?Java ConfigurationParser怎么用?Java ConfigurationParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConfigurationParser类属于org.mybatis.generator.config.xml包,在下文中一共展示了ConfigurationParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: gen

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
public void gen() {
    logger.info("开始执行mybatis代码生成工具");
    List<String> warnings = new ArrayList<>();
    /*覆盖原生成的代码*/
    boolean overwrite = true;
    try {
        ConfigurationParser cp = new ConfigurationParser(warnings);
        config = cp.parseConfiguration(Dalgen.class.getClassLoader().getResourceAsStream(
                propertiesLocation));
        DefaultShellCallback callback = new DefaultShellCallback(overwrite);
        MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
        myBatisGenerator.generate(null);
        if (warnings.size() != 0) {
            logger.info("请注意下面的警告");
        }
        for (String warning : warnings) {
            logger.info(warning);
        }
        logger.info("代码生成完成");
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:ychaoyang,项目名称:autotest,代码行数:24,代码来源:Dalgen.java

示例2: testGenerateMyBatis3WithInvalidConfig

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
@Test(expected=InvalidConfigurationException.class)
public void testGenerateMyBatis3WithInvalidConfig() throws Exception {
    List<String> warnings = new ArrayList<String>();
    ConfigurationParser cp = new ConfigurationParser(warnings);
    Configuration config = cp.parseConfiguration(this.getClass().getClassLoader().getResourceAsStream("generatorConfigMyBatis3_badConfig.xml"));
        
    DefaultShellCallback shellCallback = new DefaultShellCallback(true);
    
    try {
        MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, shellCallback, warnings);
        myBatisGenerator.generate(null, null, null, true);
    } catch (InvalidConfigurationException e) {
        assertEquals(2, e.getErrors().size());
        throw e;
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:17,代码来源:MyBatisGeneratorTest.java

示例3: testGenerateIbatis2WithInvalidConfig

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
@Test(expected=InvalidConfigurationException.class)
public void testGenerateIbatis2WithInvalidConfig() throws Exception {
    List<String> warnings = new ArrayList<String>();
    ConfigurationParser cp = new ConfigurationParser(warnings);
    Configuration config = cp.parseConfiguration(this.getClass().getClassLoader().getResourceAsStream("generatorConfigIbatis2_badConfig.xml"));
        
    DefaultShellCallback shellCallback = new DefaultShellCallback(true);
    
    try {
        MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, shellCallback, warnings);
        myBatisGenerator.generate(null, null, null, false);
    } catch (InvalidConfigurationException e) {
        assertEquals(1, e.getErrors().size());
        throw e;
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:17,代码来源:MyBatisGeneratorTest.java

示例4: testGenerateMyBatis3WithInvalidConfig

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
@Test(expected=InvalidConfigurationException.class)
public void testGenerateMyBatis3WithInvalidConfig() throws Exception {
    List<String> warnings = new ArrayList<String>();
    ConfigurationParser cp = new ConfigurationParser(warnings);
    Configuration config = cp.parseConfiguration(this.getClass().getClassLoader().getResourceAsStream("generatorConfigMyBatis3_badConfig.xml"));
        
    DefaultShellCallback shellCallback = new DefaultShellCallback(true);
    
    try {
        MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, shellCallback, warnings);
        myBatisGenerator.generate(null, null, null, false);
    } catch (InvalidConfigurationException e) {
        assertEquals(2, e.getErrors().size());
        throw e;
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:17,代码来源:MyBatisGeneratorTest.java

示例5: onOK

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
private void onOK() throws Exception {
    Main.this.setTitle("正在运行...");
    FileUtils.deleteDirectory( new File("src"));
    File dir = new File("src");
    if (!dir.exists()) {
        dir.mkdir();
    }
    List<String> warnings = new ArrayList<String>();
    boolean overwrite = true;
    ConfigurationParser cp = new ConfigurationParser(warnings);
    FileInputStream fileInputStream = new FileInputStream("generatorConfig.xml");
    Configuration config = cp.parseConfiguration(fileInputStream);
    DefaultShellCallback callback = new DefaultShellCallback(overwrite);
    MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
    myBatisGenerator.generate(null);
    Main.this.setTitle("运行成功!");
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:18,代码来源:Main.java

示例6: generator

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
public static void generator(){  
      
    List<String> warnings=new ArrayList<String>();  
    try {   
    //specify the location of the  config file to generator
    File configFile=new File("./src/main/resources/mybatis/mybatis-generator/mybatis-generator.xml");  
    //parser the file
    ConfigurationParser cp=new ConfigurationParser(warnings);  
    Configuration config=cp.parseConfiguration(configFile);  
    //set whether the file could be override
    DefaultShellCallback dsc=new DefaultShellCallback(true);  
    MyBatisGenerator mg=new MyBatisGenerator(config, dsc, warnings);  
    mg.generate(null);  
    } catch (Exception e) {  
        e.printStackTrace();  
    }  
      
}
 
开发者ID:KeithLaiKB,项目名称:SpringMvcMavenDB,代码行数:19,代码来源:GeneratorExecution.java

示例7: testGenerateMyBatis3

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
@Test(expected=InvalidConfigurationException.class)
public void testGenerateMyBatis3() throws Exception {
    List<String> warnings = new ArrayList<String>();
    ConfigurationParser cp = new ConfigurationParser(warnings);
    Configuration config = cp.parseConfiguration(this.getClass().getClassLoader().getResourceAsStream("generatorConfigMyBatis3.xml"));
        
    DefaultShellCallback shellCallback = new DefaultShellCallback(true);
    
    try {
        MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, shellCallback, warnings);
        myBatisGenerator.generate(null);
    } catch (InvalidConfigurationException e) {
        assertEquals(2, e.getErrors().size());
        throw e;
    }
}
 
开发者ID:backkoms,项目名称:mybatis-generator-comments,代码行数:17,代码来源:MyBatisGeneratorTest.java

示例8: testGenerateIbatis2

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
@Test(expected=InvalidConfigurationException.class)
public void testGenerateIbatis2() throws Exception {
    List<String> warnings = new ArrayList<String>();
    ConfigurationParser cp = new ConfigurationParser(warnings);
    Configuration config = cp.parseConfiguration(this.getClass().getClassLoader().getResourceAsStream("generatorConfigIbatis2.xml"));
        
    DefaultShellCallback shellCallback = new DefaultShellCallback(true);
    
    try {
        MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, shellCallback, warnings);
        myBatisGenerator.generate(null);
    } catch (InvalidConfigurationException e) {
        assertEquals(1, e.getErrors().size());
        throw e;
    }
}
 
开发者ID:backkoms,项目名称:mybatis-generator-comments,代码行数:17,代码来源:MyBatisGeneratorTest.java

示例9: generator

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
public void generator() throws Exception {

		List<String> warnings = new ArrayList<String>();
		boolean overwrite = true;
		// 指定 逆向工程配置文件
		String resource = Thread.currentThread().getContextClassLoader()
				.getResource("generatorConfig.xml").toString().substring(6);
		System.out.println(resource);
		File configFile = new File(resource);
		ConfigurationParser cp = new ConfigurationParser(warnings);
		Configuration config = cp.parseConfiguration(configFile);
		DefaultShellCallback callback = new DefaultShellCallback(overwrite);
		MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config,callback, warnings);
		myBatisGenerator.generate(null);

	}
 
开发者ID:MyCATApache,项目名称:Mycat-openEP,代码行数:17,代码来源:GeneratorSqlmap.java

示例10: testGenerateMyBatis3

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
@Test
public void testGenerateMyBatis3() throws Exception {
    List<String> warnings = new ArrayList<String>();
    ConfigurationParser cp = new ConfigurationParser(warnings);
    Configuration config = cp.parseConfiguration(this.getClass().getClassLoader().getResourceAsStream("generatorConfigMyBatis3.xml"));
        
    DefaultShellCallback shellCallback = new DefaultShellCallback(true);
    
    boolean gotException = false;
    try {
        MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, shellCallback, warnings);
        myBatisGenerator.generate(null);
    } catch (InvalidConfigurationException e) {
        assertEquals(3, e.getErrors().size());
        gotException = true;
    }

    if (!gotException) {
        fail("Should throw InvalidConfigurationException");
    }
}
 
开发者ID:fnyexx,项目名称:mybator,代码行数:22,代码来源:MyBatisGeneratorTest.java

示例11: testGenerateIbatis2

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
@Test
public void testGenerateIbatis2() throws Exception {
    List<String> warnings = new ArrayList<String>();
    ConfigurationParser cp = new ConfigurationParser(warnings);
    Configuration config = cp.parseConfiguration(this.getClass().getClassLoader().getResourceAsStream("generatorConfigIbatis2.xml"));
        
    DefaultShellCallback shellCallback = new DefaultShellCallback(true);
    
    boolean gotException = false;
    try {
        MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, shellCallback, warnings);
        myBatisGenerator.generate(null);
    } catch (InvalidConfigurationException e) {
        assertEquals(1, e.getErrors().size());
        gotException = true;
    }

    if (!gotException) {
        fail("Should throw InvalidConfigurationException");
    }
}
 
开发者ID:fnyexx,项目名称:mybator,代码行数:22,代码来源:MyBatisGeneratorTest.java

示例12: generator

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
public void generator() throws Exception{

		List<String> warnings = new ArrayList<String>();
		boolean overwrite = true;
		//指定 逆向工程配置文件
		File configFile = new File("generatorConfig.xml"); 
		ConfigurationParser cp = new ConfigurationParser(warnings);
		Configuration config = cp.parseConfiguration(configFile);
		DefaultShellCallback callback = new DefaultShellCallback(overwrite);
		MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config,
				callback, warnings);
		myBatisGenerator.generate(null);

	}
 
开发者ID:ChenXcc,项目名称:taotao-shop,代码行数:15,代码来源:GeneratorSqlmap.java

示例13: generateJavaFiles

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
private static List<GeneratedJavaFile> generateJavaFiles(String configFile) throws Exception {
    List<String> warnings = new ArrayList<String>();
    ConfigurationParser cp = new ConfigurationParser(warnings);
    Configuration config = cp.parseConfiguration(JavaCodeGenerationTest.class.getResourceAsStream(configFile));
        
    DefaultShellCallback shellCallback = new DefaultShellCallback(true);
    
    MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, shellCallback, warnings);
    myBatisGenerator.generate(null, null, null, false);
    return myBatisGenerator.getGeneratedJavaFiles();
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:12,代码来源:JavaCodeGenerationTest.java

示例14: generateXmlFiles

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
private static List<GeneratedXmlFile> generateXmlFiles(String configFile) throws Exception {
    List<String> warnings = new ArrayList<String>();
    ConfigurationParser cp = new ConfigurationParser(warnings);
    Configuration config = cp.parseConfiguration(JavaCodeGenerationTest.class.getResourceAsStream(configFile));
        
    DefaultShellCallback shellCallback = new DefaultShellCallback(true);
    
    MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, shellCallback, warnings);
    myBatisGenerator.generate(null, null, null, false);
    return myBatisGenerator.getGeneratedXmlFiles();
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:12,代码来源:XmlCodeGenerationTest.java

示例15: main

import org.mybatis.generator.config.xml.ConfigurationParser; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	List<String> warnings = new ArrayList<String>();
	boolean overwrite = true;
	File configFile = new File("generatorConfig.xml");
	ConfigurationParser cp = new ConfigurationParser(warnings);
	org.mybatis.generator.config.Configuration config = cp.parseConfiguration(configFile);
	DefaultShellCallback callback = new DefaultShellCallback(overwrite);
	MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config,
			callback, warnings);
	myBatisGenerator.generate(null);
}
 
开发者ID:ynztlxdeai,项目名称:MybatisGen,代码行数:12,代码来源:Generator.java


注:本文中的org.mybatis.generator.config.xml.ConfigurationParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。