org.mybatis.generator.config.CommentGeneratorConfiguration Java Examples

The following examples show how to use org.mybatis.generator.config.CommentGeneratorConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MyBatisGeneratorConfigurationParser.java    From mapper-generator-javafx with Apache License 2.0 6 votes vote down vote up
protected void parseCommentGenerator(Context context, Node node) {
    CommentGeneratorConfiguration commentGeneratorConfiguration = new CommentGeneratorConfiguration();

    context.setCommentGeneratorConfiguration(commentGeneratorConfiguration);

    Properties attributes = parseAttributes(node);
    String type = attributes.getProperty("type");

    if (stringHasValue(type)) {
        commentGeneratorConfiguration.setConfigurationType(type);
    }

    NodeList nodeList = node.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node childNode = nodeList.item(i);

        if (childNode.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }

        if ("property".equals(childNode.getNodeName())) {
            parseProperty(commentGeneratorConfiguration, childNode);
        }
    }
}
 
Example #2
Source File: IbatorConfigurationParser.java    From mybatis-generator-core-fix with Apache License 2.0 6 votes vote down vote up
private void parseCommentGenerator(Context context, Node node) {
    CommentGeneratorConfiguration commentGeneratorConfiguration = new CommentGeneratorConfiguration();

    context.setCommentGeneratorConfiguration(commentGeneratorConfiguration);

    Properties attributes = parseAttributes(node);
    String type = attributes.getProperty("type"); //$NON-NLS-1$

    if (stringHasValue(type)) {
        commentGeneratorConfiguration.setConfigurationType(type);
    }

    NodeList nodeList = node.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node childNode = nodeList.item(i);

        if (childNode.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }

        if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
            parseProperty(commentGeneratorConfiguration, childNode);
        }
    }
}
 
Example #3
Source File: MyBatisGeneratorConfigurationParser.java    From mybatis-generator-core-fix with Apache License 2.0 6 votes vote down vote up
private void parseCommentGenerator(Context context, Node node) {
    CommentGeneratorConfiguration commentGeneratorConfiguration = new CommentGeneratorConfiguration();

    context.setCommentGeneratorConfiguration(commentGeneratorConfiguration);

    Properties attributes = parseAttributes(node);
    String type = attributes.getProperty("type"); //$NON-NLS-1$

    if (stringHasValue(type)) {
        commentGeneratorConfiguration.setConfigurationType(type);
    }

    NodeList nodeList = node.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node childNode = nodeList.item(i);

        if (childNode.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }

        if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
            parseProperty(commentGeneratorConfiguration, childNode);
        }
    }
}
 
Example #4
Source File: IbatorConfigurationParser.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
private void parseCommentGenerator(Context context, Node node) {
    CommentGeneratorConfiguration commentGeneratorConfiguration = new CommentGeneratorConfiguration();

    context.setCommentGeneratorConfiguration(commentGeneratorConfiguration);

    Properties attributes = parseAttributes(node);
    String type = attributes.getProperty("type"); //$NON-NLS-1$

    if (stringHasValue(type)) {
        commentGeneratorConfiguration.setConfigurationType(type);
    }

    NodeList nodeList = node.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node childNode = nodeList.item(i);

        if (childNode.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }

        if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
            parseProperty(commentGeneratorConfiguration, childNode);
        }
    }
}
 
Example #5
Source File: MyBatisGeneratorConfigurationParser.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
private void parseCommentGenerator(Context context, Node node) {
    CommentGeneratorConfiguration commentGeneratorConfiguration = new CommentGeneratorConfiguration();

    context.setCommentGeneratorConfiguration(commentGeneratorConfiguration);

    Properties attributes = parseAttributes(node);
    String type = attributes.getProperty("type"); //$NON-NLS-1$

    if (stringHasValue(type)) {
        commentGeneratorConfiguration.setConfigurationType(type);
    }

    NodeList nodeList = node.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node childNode = nodeList.item(i);

        if (childNode.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }

        if ("property".equals(childNode.getNodeName())) { //$NON-NLS-1$
            parseProperty(commentGeneratorConfiguration, childNode);
        }
    }
}
 
Example #6
Source File: GenPlugin.java    From scaffold-cloud with MIT License 5 votes vote down vote up
@Override
public void setContext(Context context) {
    super.setContext(context);
    // 设置默认的注释生成器
    commentCfg = new CommentGeneratorConfiguration();
    commentCfg.setConfigurationType(GenCommentGenerator.class.getCanonicalName());
    context.setCommentGeneratorConfiguration(commentCfg);
    // 支持oracle获取注释#114
    context.getJdbcConnectionConfiguration().addProperty("remarksReporting", "true");
}
 
Example #7
Source File: MyPgMapperPlugin.java    From jvue-admin with MIT License 5 votes vote down vote up
@Override
public void setContext(Context context) {
    super.setContext(context);
    //设置默认的注释生成器
    commentCfg = new CommentGeneratorConfiguration();
    commentCfg.setConfigurationType(MyMapperCommentGenerator.class.getCanonicalName());
    context.setCommentGeneratorConfiguration(commentCfg);
    //支持oracle获取注释#114
    context.getJdbcConnectionConfiguration().addProperty("remarksReporting", "true");
}
 
Example #8
Source File: MapperPlugin.java    From tk-mybatis with MIT License 5 votes vote down vote up
@Override
public void setContext(Context context) {
    super.setContext(context);
    //设置默认的注释生成器
    commentCfg = new CommentGeneratorConfiguration();
    commentCfg.setConfigurationType(MapperCommentGenerator.class.getCanonicalName());
    context.setCommentGeneratorConfiguration(commentCfg);
    //支持oracle获取注释#114
    context.getJdbcConnectionConfiguration().addProperty("remarksReporting", "true");
}
 
Example #9
Source File: TemplateCommentGenerator.java    From mybatis-generator-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * 构造函数
 * @param context
 * @param templatePath  模板路径
 */
public TemplateCommentGenerator(Context context, String templatePath) {
    try {
        Document doc = null;
        File file = new File(templatePath);
        if (file.exists()) {
            doc = new SAXReader().read(file);
        } else {
            logger.error("没有找到对应注释模板:" + templatePath);
        }

        // 遍历comment 节点
        if (doc != null) {
            for (EnumNode node : EnumNode.values()) {
                Element element = doc.getRootElement().elementByID(node.value());
                if (element != null) {
                    Configuration cfg = new Configuration(Configuration.VERSION_2_3_26);
                    // 字符串清理
                    Template template = new Template(node.value(), element.getText(), cfg);
                    templates.put(node, template);
                }
            }
        }

        // 解析mybatis generator 注释配置
        CommentGeneratorConfiguration config = context.getCommentGeneratorConfiguration();
        if (config != null) {
            this.addConfigurationProperties(config.getProperties());
        }
    } catch (Exception e) {
        logger.error("注释模板XML解析失败!", e);
    }
}
 
Example #10
Source File: CrudSupportPlugin.java    From azeroth with Apache License 2.0 5 votes vote down vote up
@Override
public void setContext(Context context) {
    super.setContext(context);
    //设置默认的注释生成器
    commentCfg = new CommentGeneratorConfiguration();
    commentCfg.setConfigurationType(MapperCommentGenerator.class.getCanonicalName());
    context.setCommentGeneratorConfiguration(commentCfg);
    //支持oracle获取注释#114
    context.getJdbcConnectionConfiguration().addProperty("remarksReporting", "true");
}
 
Example #11
Source File: CrudSupportPlugin.java    From jeesuite-libs with Apache License 2.0 5 votes vote down vote up
@Override
public void setContext(Context context) {
    super.setContext(context);
    //设置默认的注释生成器
    commentCfg = new CommentGeneratorConfiguration();
    commentCfg.setConfigurationType(MapperCommentGenerator.class.getCanonicalName());
    context.setCommentGeneratorConfiguration(commentCfg);
    //支持oracle获取注释#114
    context.getJdbcConnectionConfiguration().addProperty("remarksReporting", "true");
}
 
Example #12
Source File: MapperPlugin.java    From Mapper with MIT License 5 votes vote down vote up
@Override
public void setContext(Context context) {
    super.setContext(context);
    //设置默认的注释生成器
    useMapperCommentGenerator = !"FALSE".equalsIgnoreCase(context.getProperty("useMapperCommentGenerator"));
    if (useMapperCommentGenerator) {
        commentCfg = new CommentGeneratorConfiguration();
        commentCfg.setConfigurationType(MapperCommentGenerator.class.getCanonicalName());
        context.setCommentGeneratorConfiguration(commentCfg);
    }
    //支持oracle获取注释#114
    context.getJdbcConnectionConfiguration().addProperty("remarksReporting", "true");
    //支持mysql获取注释
    context.getJdbcConnectionConfiguration().addProperty("useInformationSchema", "true");
}