All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.ibatis.builder.xml.dynamic.ChooseSqlNode Maven / Gradle / Ivy

There is a newer version: 3.0-beta-10
Show newest version
package org.apache.ibatis.builder.xml.dynamic;

import java.util.List;

public class ChooseSqlNode implements SqlNode {
  private SqlNode defaultSqlNode;
  private List ifSqlNodes;

  public ChooseSqlNode(List ifSqlNodes, SqlNode defaultSqlNode) {
    this.ifSqlNodes = ifSqlNodes;
    this.defaultSqlNode = defaultSqlNode;
  }

  public boolean apply(DynamicContext context) {
    for (SqlNode sqlNode : ifSqlNodes) {
      if (sqlNode.apply(context)) {
        return true;
      }
    }
    if (defaultSqlNode != null) {
      defaultSqlNode.apply(context);
      return true;
    }
    return false;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy