Ejemplo n.º 1
0
 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);
   }
 }
Ejemplo n.º 2
0
 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);
       ParameterMapping parameterMapping =
           builderAssistant.buildParameterMapping(
               parameterClass,
               property,
               javaTypeClass,
               jdbcTypeEnum,
               resultMap,
               modeEnum,
               typeHandlerClass,
               numericScale);
       parameterMappings.add(parameterMapping);
     }
     builderAssistant.addParameterMap(id, parameterClass, parameterMappings);
   }
 }