Search in sources :

Example 1 with JavaTypeResolverConfiguration

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

the class MyBatisGeneratorConfigurationParser method parseJavaTypeResolver.

protected void parseJavaTypeResolver(Context context, Node node) {
    JavaTypeResolverConfiguration javaTypeResolverConfiguration = new JavaTypeResolverConfiguration();
    context.setJavaTypeResolverConfiguration(javaTypeResolverConfiguration);
    Properties attributes = parseAttributes(node);
    //$NON-NLS-1$
    String type = attributes.getProperty("type");
    if (stringHasValue(type)) {
        javaTypeResolverConfiguration.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(javaTypeResolverConfiguration, childNode);
        }
    }
}
Also used : NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) JavaTypeResolverConfiguration(org.mybatis.generator.config.JavaTypeResolverConfiguration) Messages.getString(org.mybatis.generator.internal.util.messages.Messages.getString) Properties(java.util.Properties)

Example 2 with JavaTypeResolverConfiguration

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

the class ObjectFactory method createJavaTypeResolver.

/**
     * Creates a new Object object.
     *
     * @param context
     *            the context
     * @param warnings
     *            the warnings
     * @return the java type resolver
     */
public static JavaTypeResolver createJavaTypeResolver(Context context, List<String> warnings) {
    JavaTypeResolverConfiguration config = context.getJavaTypeResolverConfiguration();
    String type;
    if (config != null && config.getConfigurationType() != null) {
        type = config.getConfigurationType();
        if ("DEFAULT".equalsIgnoreCase(type)) {
            //$NON-NLS-1$
            type = JavaTypeResolverDefaultImpl.class.getName();
        }
    } else {
        type = JavaTypeResolverDefaultImpl.class.getName();
    }
    JavaTypeResolver answer = (JavaTypeResolver) createInternalObject(type);
    answer.setWarnings(warnings);
    if (config != null) {
        answer.addConfigurationProperties(config.getProperties());
    }
    answer.setContext(context);
    return answer;
}
Also used : JavaTypeResolver(org.mybatis.generator.api.JavaTypeResolver) JavaTypeResolverConfiguration(org.mybatis.generator.config.JavaTypeResolverConfiguration) Messages.getString(org.mybatis.generator.internal.util.messages.Messages.getString) JavaTypeResolverDefaultImpl(org.mybatis.generator.internal.types.JavaTypeResolverDefaultImpl)

Aggregations

JavaTypeResolverConfiguration (org.mybatis.generator.config.JavaTypeResolverConfiguration)2 Messages.getString (org.mybatis.generator.internal.util.messages.Messages.getString)2 Properties (java.util.Properties)1 JavaTypeResolver (org.mybatis.generator.api.JavaTypeResolver)1 JavaTypeResolverDefaultImpl (org.mybatis.generator.internal.types.JavaTypeResolverDefaultImpl)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1