Search in sources :

Example 1 with JavaClientGeneratorConfiguration

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

the class IntrospectedTable method calculateJavaClientInterfacePackage.

/**
     * Calculate java client interface package.
     *
     * @return the string
     */
protected String calculateJavaClientInterfacePackage() {
    JavaClientGeneratorConfiguration config = context.getJavaClientGeneratorConfiguration();
    if (config == null) {
        return null;
    }
    StringBuilder sb = new StringBuilder();
    sb.append(config.getTargetPackage());
    sb.append(fullyQualifiedTable.getSubPackageForClientOrSqlMap(isSubPackagesEnabled(config)));
    return sb.toString();
}
Also used : JavaClientGeneratorConfiguration(org.mybatis.generator.config.JavaClientGeneratorConfiguration)

Example 2 with JavaClientGeneratorConfiguration

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

the class IntrospectedTable method calculateJavaClientImplementationPackage.

/**
     * Calculate java client implementation package.
     *
     * @return the string
     */
protected String calculateJavaClientImplementationPackage() {
    JavaClientGeneratorConfiguration config = context.getJavaClientGeneratorConfiguration();
    if (config == null) {
        return null;
    }
    StringBuilder sb = new StringBuilder();
    if (stringHasValue(config.getImplementationPackage())) {
        sb.append(config.getImplementationPackage());
    } else {
        sb.append(config.getTargetPackage());
    }
    sb.append(fullyQualifiedTable.getSubPackageForClientOrSqlMap(isSubPackagesEnabled(config)));
    return sb.toString();
}
Also used : JavaClientGeneratorConfiguration(org.mybatis.generator.config.JavaClientGeneratorConfiguration)

Example 3 with JavaClientGeneratorConfiguration

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

the class MyBatisGeneratorConfigurationParser method parseJavaClientGenerator.

private void parseJavaClientGenerator(Context context, Node node) {
    JavaClientGeneratorConfiguration javaClientGeneratorConfiguration = new JavaClientGeneratorConfiguration();
    context.setJavaClientGeneratorConfiguration(javaClientGeneratorConfiguration);
    Properties attributes = parseAttributes(node);
    //$NON-NLS-1$
    String type = attributes.getProperty("type");
    //$NON-NLS-1$
    String targetPackage = attributes.getProperty("targetPackage");
    //$NON-NLS-1$
    String targetProject = attributes.getProperty("targetProject");
    String implementationPackage = attributes.getProperty(//$NON-NLS-1$
    "implementationPackage");
    javaClientGeneratorConfiguration.setConfigurationType(type);
    javaClientGeneratorConfiguration.setTargetPackage(targetPackage);
    javaClientGeneratorConfiguration.setTargetProject(targetProject);
    javaClientGeneratorConfiguration.setImplementationPackage(implementationPackage);
    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(javaClientGeneratorConfiguration, childNode);
        }
    }
}
Also used : NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) JavaClientGeneratorConfiguration(org.mybatis.generator.config.JavaClientGeneratorConfiguration) Messages.getString(org.mybatis.generator.internal.util.messages.Messages.getString) Properties(java.util.Properties)

Example 4 with JavaClientGeneratorConfiguration

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

the class IbatorConfigurationParser method parseDaoGenerator.

private void parseDaoGenerator(Context context, Node node) {
    JavaClientGeneratorConfiguration javaClientGeneratorConfiguration = new JavaClientGeneratorConfiguration();
    context.setJavaClientGeneratorConfiguration(javaClientGeneratorConfiguration);
    Properties attributes = parseAttributes(node);
    //$NON-NLS-1$
    String type = attributes.getProperty("type");
    //$NON-NLS-1$
    String targetPackage = attributes.getProperty("targetPackage");
    //$NON-NLS-1$
    String targetProject = attributes.getProperty("targetProject");
    String implementationPackage = attributes.getProperty(//$NON-NLS-1$
    "implementationPackage");
    javaClientGeneratorConfiguration.setConfigurationType(type);
    javaClientGeneratorConfiguration.setTargetPackage(targetPackage);
    javaClientGeneratorConfiguration.setTargetProject(targetProject);
    javaClientGeneratorConfiguration.setImplementationPackage(implementationPackage);
    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(javaClientGeneratorConfiguration, childNode);
        }
    }
}
Also used : NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) JavaClientGeneratorConfiguration(org.mybatis.generator.config.JavaClientGeneratorConfiguration) Properties(java.util.Properties)

Aggregations

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