org.apache.ibatis.session.Configuration.isResourceLoaded()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.apache.ibatis.session.Configuration.isResourceLoaded()方法的一些代码示例,展示了Configuration.isResourceLoaded()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.isResourceLoaded()方法的具体详情如下:
包路径:org.apache.ibatis.session.Configuration
类名称:Configuration
方法名:isResourceLoaded

Configuration.isResourceLoaded介绍

暂无

代码示例

代码示例来源:origin: SonarSource/sonarqube

@Override
public void parse() {
 if (!configuration.isResourceLoaded(mapperType.getName())) {
  super.parse();
  retryBindMapperForNamespace();
 }
 super.parse();
}

代码示例来源:origin: baomidou/mybatis-plus

private void loadXmlResource() {
  // Spring may not know the real resource name so we check a flag
  // to prevent loading again a resource twice
  // this flag is set at XMLMapperBuilder#bindMapperForNamespace
  if (!configuration.isResourceLoaded("namespace:" + type.getName())) {
    String xmlResource = type.getName().replace('.', '/') + ".xml";
    // #1347
    InputStream inputStream = type.getResourceAsStream("/" + xmlResource);
    if (inputStream == null) {
      // Search XML mapper that is not in the module but in the classpath.
      try {
        inputStream = Resources.getResourceAsStream(type.getClassLoader(), xmlResource);
      } catch (IOException e2) {
        // ignore, resource is not required
      }
    }
    if (inputStream != null) {
      XMLMapperBuilder xmlParser = new XMLMapperBuilder(inputStream, assistant.getConfiguration(), xmlResource, configuration.getSqlFragments(), type.getName());
      xmlParser.parse();
    }
  }
}

代码示例来源:origin: baomidou/mybatis-plus

public void parse() {
  String resource = type.toString();
  if (!configuration.isResourceLoaded(resource)) {
    loadXmlResource();
    configuration.addLoadedResource(resource);

代码示例来源:origin: camunda/camunda-bpm-platform

private void loadXmlResource() {
 // Spring may not know the real resource name so we check a flag
 // to prevent loading again a resource twice
 // this flag is set at XMLMapperBuilder#bindMapperForNamespace
 if (!configuration.isResourceLoaded("namespace:" + type.getName())) {
  String xmlResource = type.getName().replace('.', '/') + ".xml";
  InputStream inputStream = null;
  try {
   inputStream = Resources.getResourceAsStream(type.getClassLoader(), xmlResource);
  } catch (IOException e) {
   // ignore, resource is not required
  }
  if (inputStream != null) {
   XMLMapperBuilder xmlParser = new XMLMapperBuilder(inputStream, assistant.getConfiguration(), xmlResource, configuration.getSqlFragments(), type.getName());
   xmlParser.parse();
  }
 }
}

代码示例来源:origin: org.mybatis/mybatis

private void loadXmlResource() {
 // Spring may not know the real resource name so we check a flag
 // to prevent loading again a resource twice
 // this flag is set at XMLMapperBuilder#bindMapperForNamespace
 if (!configuration.isResourceLoaded("namespace:" + type.getName())) {
  String xmlResource = type.getName().replace('.', '/') + ".xml";
  // #1347
  InputStream inputStream = type.getResourceAsStream("/" + xmlResource);
  if (inputStream == null) {
   // Search XML mapper that is not in the module but in the classpath.
   try {
    inputStream = Resources.getResourceAsStream(type.getClassLoader(), xmlResource);
   } catch (IOException e2) {
    // ignore, resource is not required
   }
  }
  if (inputStream != null) {
   XMLMapperBuilder xmlParser = new XMLMapperBuilder(inputStream, assistant.getConfiguration(), xmlResource, configuration.getSqlFragments(), type.getName());
   xmlParser.parse();
  }
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void parse() {
 String resource = type.toString();
 if (!configuration.isResourceLoaded(resource)) {
  loadXmlResource();
  configuration.addLoadedResource(resource);
  assistant.setCurrentNamespace(type.getName());
  parseCache();
  parseCacheRef();
  Method[] methods = type.getMethods();
  for (Method method : methods) {
   try {
    // issue #237
    if (!method.isBridge()) {
     parseStatement(method);
    }
   } catch (IncompleteElementException e) {
    configuration.addIncompleteMethod(new MethodResolver(this, method));
   }
  }
 }
 parsePendingMethods();
}

代码示例来源:origin: org.mybatis/mybatis

public void parse() {
 String resource = type.toString();
 if (!configuration.isResourceLoaded(resource)) {
  loadXmlResource();
  configuration.addLoadedResource(resource);
  assistant.setCurrentNamespace(type.getName());
  parseCache();
  parseCacheRef();
  Method[] methods = type.getMethods();
  for (Method method : methods) {
   try {
    // issue #237
    if (!method.isBridge()) {
     parseStatement(method);
    }
   } catch (IncompleteElementException e) {
    configuration.addIncompleteMethod(new MethodResolver(this, method));
   }
  }
 }
 parsePendingMethods();
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void parse() {
 if (!configuration.isResourceLoaded(resource)) {
  configurationElement(parser.evalNode("/mapper"));
  configuration.addLoadedResource(resource);
  bindMapperForNamespace();
 }
 parsePendingResultMaps();
 parsePendingCacheRefs();
 parsePendingStatements();
}

代码示例来源:origin: org.mybatis/mybatis

public void parse() {
 if (!configuration.isResourceLoaded(resource)) {
  configurationElement(parser.evalNode("/mapper"));
  configuration.addLoadedResource(resource);
  bindMapperForNamespace();
 }
 parsePendingResultMaps();
 parsePendingCacheRefs();
 parsePendingStatements();
}

代码示例来源:origin: com.intoverflow.booster/booster-core

public void enhance() {
//        String resource = "interface " + namespace;
    if (!configuration.isResourceLoaded(resource)) {
      configuration.addLoadedResource(resource);
    }
    assistant.setCurrentNamespace(namespace);

    if (!type.isAnnotationPresent(Entity.class)) {
      return;
    }

    // build and register ResultMap;
    try {
      ResultMapAdapter.parseResultMap(assistant, entityMetaData);
    } catch (Exception e) {
      log.error(e.getMessage(), e);
    }
  }

代码示例来源:origin: org.sonarsource.sonarqube/sonar-db

@Override
public void parse() {
 if (!configuration.isResourceLoaded(mapperType.getName())) {
  super.parse();
  retryBindMapperForNamespace();
 }
 super.parse();
}

代码示例来源:origin: com.intoverflow.booster/booster-core

if (!configuration.isResourceLoaded(resource)) {
  configuration.addLoadedResource(resource);

代码示例来源:origin: org.apache.ibatis/ibatis-core

public void parse() {
 if (!configuration.isResourceLoaded(resource)) {
  configuration.addLoadedResource(resource);
  configurationElement(parser.evalNode("/mapper"));
  bindMapperForNamespace();
 }
}

代码示例来源:origin: org.apache.ibatis/ibatis-core

public void parse() {
 String resource = type.toString();
 if (!configuration.isResourceLoaded(resource)) {
  configuration.addLoadedResource(resource);
  loadXmlResource();
  assistant.setCurrentNamespace(type.getName());
  parseCache();
  parseCacheRef();
  Method[] methods = type.getMethods();
  for (Method method : methods) {
   parseResultsAndConstructorArgs(method);
   parseStatement(method);
  }
 }
}

代码示例来源:origin: svili365/mybatis-jpa

@Override
public void parseStatement(Method method) {
 if (!configuration.isResourceLoaded(method.getDeclaringClass().toString())) {
  configuration.addLoadedResource(method.getDeclaringClass().toString());
 }
 LanguageDriver languageDriver = configuration.getDefaultScriptingLanuageInstance();
 SqlSource sqlSource = languageDriver
   .createSqlSource(configuration, parseSQL(method), Object.class);
 String statementId = method.getDeclaringClass().getName() + "." + method.getName();
 MappedStatement.Builder builder = new MappedStatement.Builder(configuration, statementId,
   sqlSource, recognizeSqlCommandType(method));
 String resource = recognizeResource(method);
 builder.resource(resource).lang(languageDriver).statementType(StatementType.PREPARED);
 MappedStatement statement = builder.build();
 configuration.addMappedStatement(statement);
}

相关文章

微信公众号

最新文章

更多

Configuration类方法