List of usage examples for org.apache.ibatis.parsing XNode getIntAttribute
public Integer getIntAttribute(String name)
From source file:com.baomidou.mybatisplus.MybatisXMLMapperBuilder.java
License:Apache License
private void cacheElement(XNode context) throws Exception { if (context != null) { String type = context.getStringAttribute("type", "PERPETUAL"); Class<? extends Cache> typeClass = typeAliasRegistry.resolveAlias(type); String eviction = context.getStringAttribute("eviction", "LRU"); Class<? extends Cache> evictionClass = typeAliasRegistry.resolveAlias(eviction); Long flushInterval = context.getLongAttribute("flushInterval"); Integer size = context.getIntAttribute("size"); boolean readWrite = !context.getBooleanAttribute("readOnly", false); boolean blocking = context.getBooleanAttribute("blocking", false); Properties props = context.getChildrenAsProperties(); builderAssistant.useNewCache(typeClass, evictionClass, flushInterval, size, readWrite, blocking, props); }/* ww w. java2 s. c om*/ }
From source file:com.baomidou.mybatisplus.MybatisXMLMapperBuilder.java
License:Apache License
private void parameterMapElement(List<XNode> list) throws Exception { for (XNode parameterMapNode : list) { String id = parameterMapNode.getStringAttribute("id"); String type = parameterMapNode.getStringAttribute("type"); Class<?> parameterClass = resolveClass(type); List<XNode> parameterNodes = parameterMapNode.evalNodes("parameter"); List<ParameterMapping> parameterMappings = new ArrayList<>(); for (XNode parameterNode : parameterNodes) { String property = parameterNode.getStringAttribute("property"); String javaType = parameterNode.getStringAttribute("javaType"); String jdbcType = parameterNode.getStringAttribute("jdbcType"); String resultMap = parameterNode.getStringAttribute("resultMap"); String mode = parameterNode.getStringAttribute("mode"); String typeHandler = parameterNode.getStringAttribute("typeHandler"); Integer numericScale = parameterNode.getIntAttribute("numericScale"); ParameterMode modeEnum = resolveParameterMode(mode); Class<?> javaTypeClass = resolveClass(javaType); JdbcType jdbcTypeEnum = resolveJdbcType(jdbcType); @SuppressWarnings("unchecked") Class<? extends TypeHandler<?>> typeHandlerClass = (Class<? extends TypeHandler<?>>) resolveClass( typeHandler);// w ww. j a va 2 s . c om ParameterMapping parameterMapping = builderAssistant.buildParameterMapping(parameterClass, property, javaTypeClass, jdbcTypeEnum, resultMap, modeEnum, typeHandlerClass, numericScale); parameterMappings.add(parameterMapping); } builderAssistant.addParameterMap(id, parameterClass, parameterMappings); } }
From source file:com.dmm.framework.basedb.apache.ibatis.builder.xml.XMLMapperBuilder.java
License:Apache License
private void cacheElement(XNode context) throws Exception { if (context != null) { String type = context.getStringAttribute("type", "PERPETUAL"); Class<? extends Cache> typeClass = typeAliasRegistry.resolveAlias(type); String eviction = context.getStringAttribute("eviction", "LRU"); Class<? extends Cache> evictionClass = typeAliasRegistry.resolveAlias(eviction); Long flushInterval = context.getLongAttribute("flushInterval"); Integer size = context.getIntAttribute("size"); boolean readWrite = !context.getBooleanAttribute("readOnly", false); Properties props = context.getChildrenAsProperties(); builderAssistant.useNewCache(typeClass, evictionClass, flushInterval, size, readWrite, props); }/*w ww .j a v a 2s . com*/ }
From source file:com.dmm.framework.basedb.apache.ibatis.builder.xml.XMLMapperBuilder.java
License:Apache License
private void parameterMapElement(List<XNode> list) throws Exception { for (XNode parameterMapNode : list) { String id = parameterMapNode.getStringAttribute("id"); String type = parameterMapNode.getStringAttribute("type"); Class<?> parameterClass = resolveClass(type); List<XNode> parameterNodes = parameterMapNode.evalNodes("parameter"); List<ParameterMapping> parameterMappings = new ArrayList<ParameterMapping>(); for (XNode parameterNode : parameterNodes) { String property = parameterNode.getStringAttribute("property"); String javaType = parameterNode.getStringAttribute("javaType"); String jdbcType = parameterNode.getStringAttribute("jdbcType"); String resultMap = parameterNode.getStringAttribute("resultMap"); String mode = parameterNode.getStringAttribute("mode"); String typeHandler = parameterNode.getStringAttribute("typeHandler"); Integer numericScale = parameterNode.getIntAttribute("numericScale"); ParameterMode modeEnum = resolveParameterMode(mode); Class<?> javaTypeClass = resolveClass(javaType); JdbcType jdbcTypeEnum = resolveJdbcType(jdbcType); @SuppressWarnings("unchecked") Class<? extends TypeHandler<?>> typeHandlerClass = (Class<? extends TypeHandler<?>>) resolveClass( typeHandler);/*www . j a v a 2 s. c om*/ ParameterMapping parameterMapping = builderAssistant.buildParameterMapping(parameterClass, property, javaTypeClass, jdbcTypeEnum, resultMap, modeEnum, typeHandlerClass, numericScale); parameterMappings.add(parameterMapping); } builderAssistant.addParameterMap(id, parameterClass, parameterMappings); } }
From source file:com.ibatis.sqlmap.engine.builder.XmlSqlMapConfigParser.java
License:Apache License
@NodeEvent("/sqlMapConfig/settings") public void sqlMapConfigsettings(XNode context) throws Exception { boolean classInfoCacheEnabled = context.getBooleanAttribute("classInfoCacheEnabled", true); MetaClass.setClassCacheEnabled(classInfoCacheEnabled); boolean lazyLoadingEnabled = context.getBooleanAttribute("lazyLoadingEnabled", true); config.setLazyLoadingEnabled(lazyLoadingEnabled); boolean statementCachingEnabled = context.getBooleanAttribute("statementCachingEnabled", true); if (statementCachingEnabled) { config.setDefaultExecutorType(ExecutorType.REUSE); }//from w w w. j av a 2 s. co m boolean batchUpdatesEnabled = context.getBooleanAttribute("batchUpdatesEnabled", true); if (batchUpdatesEnabled) { config.setDefaultExecutorType(ExecutorType.BATCH); } boolean cacheModelsEnabled = context.getBooleanAttribute("cacheModelsEnabled", true); config.setCacheEnabled(cacheModelsEnabled); boolean useColumnLabel = context.getBooleanAttribute("useColumnLabel", false); config.setUseColumnLabel(useColumnLabel); boolean forceMultipleResultSetSupport = context.getBooleanAttribute("forceMultipleResultSetSupport", true); config.setMultipleResultSetsEnabled(forceMultipleResultSetSupport); useStatementNamespaces = context.getBooleanAttribute("useStatementNamespaces", false); Integer defaultTimeout = context.getIntAttribute("defaultStatementTimeout"); config.setDefaultStatementTimeout(defaultTimeout); }
From source file:org.mybatis.spring.utils.XMLMapperBuilder.java
License:Apache License
private void cacheElement(XNode context) throws Exception { if (context != null) { String type = context.getStringAttribute("type", "PERPETUAL"); Class<? extends Cache> typeClass = typeAliasRegistry.resolveAlias(type); String eviction = context.getStringAttribute("eviction", "LRU"); Class<? extends Cache> evictionClass = typeAliasRegistry.resolveAlias(eviction); Long flushInterval = context.getLongAttribute("flushInterval"); Integer size = context.getIntAttribute("size"); boolean readWrite = !context.getBooleanAttribute("readOnly", false); Properties props = context.getChildrenAsProperties(); builderAssistant.useNewCache(typeClass, evictionClass, flushInterval, size, readWrite, readWrite, props);//from ww w .j a va 2s. c o m } }