Search in sources :

Example 1 with JavaModelGeneratorConfiguration

use of org.mybatis.generator.config.JavaModelGeneratorConfiguration in project generator by mybatis.

the class MyBatisGeneratorConfigurationParser method parseJavaModelGenerator.

protected void parseJavaModelGenerator(Context context, Node node) {
    JavaModelGeneratorConfiguration javaModelGeneratorConfiguration = new JavaModelGeneratorConfiguration();
    context.setJavaModelGeneratorConfiguration(javaModelGeneratorConfiguration);
    Properties attributes = parseAttributes(node);
    //$NON-NLS-1$
    String targetPackage = attributes.getProperty("targetPackage");
    //$NON-NLS-1$
    String targetProject = attributes.getProperty("targetProject");
    javaModelGeneratorConfiguration.setTargetPackage(targetPackage);
    javaModelGeneratorConfiguration.setTargetProject(targetProject);
    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(javaModelGeneratorConfiguration, childNode);
        }
    }
}
Also used : JavaModelGeneratorConfiguration(org.mybatis.generator.config.JavaModelGeneratorConfiguration) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) Messages.getString(org.mybatis.generator.internal.util.messages.Messages.getString) Properties(java.util.Properties)

Example 2 with JavaModelGeneratorConfiguration

use of org.mybatis.generator.config.JavaModelGeneratorConfiguration in project generator by mybatis.

the class IntrospectedTable method calculateJavaModelPackage.

/**
     * Calculate java model package.
     *
     * @return the string
     */
protected String calculateJavaModelPackage() {
    JavaModelGeneratorConfiguration config = context.getJavaModelGeneratorConfiguration();
    StringBuilder sb = new StringBuilder();
    sb.append(config.getTargetPackage());
    sb.append(fullyQualifiedTable.getSubPackageForModel(isSubPackagesEnabled(config)));
    return sb.toString();
}
Also used : JavaModelGeneratorConfiguration(org.mybatis.generator.config.JavaModelGeneratorConfiguration)

Aggregations

JavaModelGeneratorConfiguration (org.mybatis.generator.config.JavaModelGeneratorConfiguration)2 Properties (java.util.Properties)1 Messages.getString (org.mybatis.generator.internal.util.messages.Messages.getString)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1