Java Code Examples for org.mybatis.generator.api.IntrospectedTable#setContext()

The following examples show how to use org.mybatis.generator.api.IntrospectedTable#setContext() . 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: ObjectFactory.java    From mybatis-generator-core-fix with Apache License 2.0 6 votes vote down vote up
/**
 * This method creates an introspected table implementation that is only usable for validation (i.e. for a context
 * to determine if the target is ibatis2 or mybatis3).
 * 
 *
 * @param context
 *            the context
 * @return the introspected table
 */
public static IntrospectedTable createIntrospectedTableForValidation(Context context) {
    String type = context.getTargetRuntime();
    if (!stringHasValue(type)) {
        type = IntrospectedTableMyBatis3Impl.class.getName();
    } else if ("Ibatis2Java2".equalsIgnoreCase(type)) { //$NON-NLS-1$
        type = IntrospectedTableIbatis2Java2Impl.class.getName();
    } else if ("Ibatis2Java5".equalsIgnoreCase(type)) { //$NON-NLS-1$
        type = IntrospectedTableIbatis2Java5Impl.class.getName();
    } else if ("Ibatis3".equalsIgnoreCase(type)) { //$NON-NLS-1$
        type = IntrospectedTableMyBatis3Impl.class.getName();
    } else if ("MyBatis3".equalsIgnoreCase(type)) { //$NON-NLS-1$
        type = IntrospectedTableMyBatis3Impl.class.getName();
    } else if ("MyBatis3Simple".equalsIgnoreCase(type)) { //$NON-NLS-1$
        type = IntrospectedTableMyBatis3SimpleImpl.class.getName();
    }

    IntrospectedTable answer = (IntrospectedTable) createInternalObject(type);
    answer.setContext(context);

    return answer;
}
 
Example 2
Source File: ObjectFactory.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
/**
 * This method creates an introspected table implementation that is
 * only usable for validation (i.e. for a context to determine
 * if the target is ibatis2 or mybatis3).
 *  
 * @param context
 * @return
 */
public static IntrospectedTable createIntrospectedTableForValidation(Context context) {
    String type = context.getTargetRuntime();
    if (!stringHasValue(type)) {
        type = IntrospectedTableMyBatis3Impl.class.getName();
    } else if ("Ibatis2Java2".equalsIgnoreCase(type)) { //$NON-NLS-1$
        type = IntrospectedTableIbatis2Java2Impl.class.getName();
    } else if ("Ibatis2Java5".equalsIgnoreCase(type)) { //$NON-NLS-1$
        type = IntrospectedTableIbatis2Java5Impl.class.getName();
    } else if ("Ibatis3".equalsIgnoreCase(type)) { //$NON-NLS-1$
        type = IntrospectedTableMyBatis3Impl.class.getName();
    } else if ("MyBatis3".equalsIgnoreCase(type)) { //$NON-NLS-1$
        type = IntrospectedTableMyBatis3Impl.class.getName();
    } else if ("MyBatis3Simple".equalsIgnoreCase(type)) { //$NON-NLS-1$
        type = IntrospectedTableMyBatis3SimpleImpl.class.getName();
    }

    IntrospectedTable answer = (IntrospectedTable) createInternalObject(type);
    answer.setContext(context);

    return answer;
}