Java Code Examples for org.mybatis.generator.config.Context#getProperty()
The following examples show how to use
org.mybatis.generator.config.Context#getProperty() .
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: BasePlugin.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * Set the context under which this plugin is running. * @param context the new context */ @Override public void setContext(Context context) { super.setContext(context); // 添加插件 HookAggregator.getInstance().setContext(context); // 配置插件使用的模板引擎 PluginConfiguration cfg = PluginTools.getPluginConfiguration(context, CommentPlugin.class); if (cfg == null || cfg.getProperty(CommentPlugin.PRO_TEMPLATE) == null) { commentGenerator = context.getCommentGenerator(); } else { TemplateCommentGenerator templateCommentGenerator = new TemplateCommentGenerator(context, cfg.getProperty(CommentPlugin.PRO_TEMPLATE)); // ITFSW 插件使用的注释生成器 commentGenerator = templateCommentGenerator; // 修正系统插件 try { // 先执行一次生成CommentGenerator操作,然后再替换 context.getCommentGenerator(); BeanUtils.setProperty(context, "commentGenerator", templateCommentGenerator); } catch (Exception e) { logger.error("反射异常", e); } } // mybatis版本 if (StringUtility.stringHasValue(context.getProperty(PRO_MYBATIS_VERSION))) { this.mybatisVersion = context.getProperty(PRO_MYBATIS_VERSION); } }
Example 2
Source File: ObjectFactory.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
/** * Creates a new Object object. * * @param context * the context * @return the java formatter */ public static JavaFormatter createJavaFormatter(Context context) { String type = context.getProperty(PropertyRegistry.CONTEXT_JAVA_FORMATTER); if (!StringUtility.stringHasValue(type)) { type = DefaultJavaFormatter.class.getName(); } JavaFormatter answer = (JavaFormatter) createInternalObject(type); answer.setContext(context); return answer; }
Example 3
Source File: ObjectFactory.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
/** * Creates a new Object object. * * @param context * the context * @return the xml formatter */ public static XmlFormatter createXmlFormatter(Context context) { String type = context.getProperty(PropertyRegistry.CONTEXT_XML_FORMATTER); if (!StringUtility.stringHasValue(type)) { type = DefaultXmlFormatter.class.getName(); } XmlFormatter answer = (XmlFormatter) createInternalObject(type); answer.setContext(context); return answer; }
Example 4
Source File: ObjectFactory.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
public static JavaFormatter createJavaFormatter(Context context) { String type = context.getProperty(PropertyRegistry.CONTEXT_JAVA_FORMATTER); if (!StringUtility.stringHasValue(type)) { type = DefaultJavaFormatter.class.getName(); } JavaFormatter answer = (JavaFormatter) createInternalObject(type); answer.setContext(context); return answer; }
Example 5
Source File: ObjectFactory.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
public static XmlFormatter createXmlFormatter(Context context) { String type = context.getProperty(PropertyRegistry.CONTEXT_XML_FORMATTER); if (!StringUtility.stringHasValue(type)) { type = DefaultXmlFormatter.class.getName(); } XmlFormatter answer = (XmlFormatter) createInternalObject(type); answer.setContext(context); return answer; }