获取JavaSqlInfoBuilder的实例，并初始化属性信息.
@param source BuildSource实例
@return JavaSqlInfoBuilder实例
513468
public static JavaSqlInfoBuilder newInstace(BuildSource source) {
        JavaSqlInfoBuilder builder = new JavaSqlInfoBuilder();
        builder.init(source);
        return builder;
    }
365542
public final int getJdbcType()
    {
        switch (this.fieldSource)
        {
            case SOURCE_FIELD :
                return this.getFieldRef().getJdbcType().getType();
            case SOURCE_NULL :
                return java.sql.Types.NULL;
            case SOURCE_VALUE :
                return java.sql.Types.VARCHAR;
            default :
                return java.sql.Types.NULL;
        }
    }
232505
StructuredQuery.Builder buildQuery() {
    StructuredQuery.Builder structuredQuery = StructuredQuery.newBuilder();
    structuredQuery.addFrom(
        StructuredQuery.CollectionSelector.newBuilder().setCollectionId(path.getId()));

    if (options.fieldFilters.size() == 1) {
      Filter filter = options.fieldFilters.get(0).toProto();
      if (filter.hasFieldFilter()) {
        structuredQuery.getWhereBuilder().setFieldFilter(filter.getFieldFilter());
      } else {
        Preconditions.checkState(
            filter.hasUnaryFilter(), "Expected a UnaryFilter or a FieldFilter.");
        structuredQuery.getWhereBuilder().setUnaryFilter(filter.getUnaryFilter());
      }
    } else if (options.fieldFilters.size() > 1) {
      Filter.Builder filter = Filter.newBuilder();
      StructuredQuery.CompositeFilter.Builder compositeFilter =
          StructuredQuery.CompositeFilter.newBuilder();
      compositeFilter.setOp(CompositeFilter.Operator.AND);
      for (FieldFilter fieldFilter : options.fieldFilters) {
        compositeFilter.addFilters(fieldFilter.toProto());
      }
      filter.setCompositeFilter(compositeFilter.build());
      structuredQuery.setWhere(filter.build());
    }

    if (!options.fieldOrders.isEmpty()) {
      for (FieldOrder order : options.fieldOrders) {
        structuredQuery.addOrderBy(order.toProto());
      }
    }

    if (!options.fieldProjections.isEmpty()) {
      structuredQuery.getSelectBuilder().addAllFields(options.fieldProjections);
    }

    if (options.limit != -1) {
      structuredQuery.setLimit(Int32Value.newBuilder().setValue(options.limit));
    }

    if (options.offset != -1) {
      structuredQuery.setOffset(options.offset);
    }

    if (options.startCursor != null) {
      structuredQuery.setStartAt(options.startCursor);
    }

    if (options.endCursor != null) {
      structuredQuery.setEndAt(options.endCursor);
    }

    return structuredQuery;
  }
1314518
public static DataSource createDataSource(String source, String type, String... configs){
		String config = StringUtils.join(configs, " ");
		return createDataSource(source, type, config);
	}
877769
private SqlInfo doBuildSqlInfo(BuildSource source, String valueText) {
        SqlInfo sqlInfo = source.getSqlInfo();
        Node node = source.getNode();
        this.concatSqlText(node, sqlInfo);
        return XmlSqlInfoBuilder.newInstace(source).buildTextSqlParams(valueText);
    }
808616
public Object sqlToJava(Object source)
    {
        try
        {
            ByteArrayInputStream stringIn =
                new ByteArrayInputStream(((String) source).getBytes());
            Base64.InputStream uuIn =
                new Base64.InputStream(stringIn, Base64.DECODE, false);
            GZIPInputStream gzipIn = new GZIPInputStream(uuIn);
            ObjectInputStream objIn = new ObjectInputStream(gzipIn);
            Object result = objIn.readObject();

            objIn.close();
            return result;
        }
        catch (Throwable t)
        {
            throw new ConversionException(t);
        }
    }
234122
@SuppressWarnings("nls")
    protected DataSource datasourceFromConfig(JdbcOptionsBean config) {
        Properties props = new Properties();
        props.putAll(config.getDsProperties());
        setConfigProperty(props, "jdbcUrl", config.getJdbcUrl());
        setConfigProperty(props, "username", config.getUsername());
        setConfigProperty(props, "password", config.getPassword());

        setConfigProperty(props, "connectionTimeout", config.getConnectionTimeout());
        setConfigProperty(props, "idleTimeout", config.getIdleTimeout());
        setConfigProperty(props, "maxPoolSize", config.getMaximumPoolSize());
        setConfigProperty(props, "maxLifetime", config.getMaxLifetime());
        setConfigProperty(props, "minIdle", config.getMinimumIdle());
        setConfigProperty(props, "poolName", config.getPoolName());
        setConfigProperty(props, "autoCommit", config.isAutoCommit());

        HikariConfig hikariConfig = new HikariConfig(props);
        return new HikariDataSource(hikariConfig);
    }
646658
public static AzkabanDataSource getMySQLDataSource(final String host, final Integer port,
      final String dbName, final String user, final String password, final Integer numConnections) {
    return new MySQLBasicDataSource(host, port, dbName, user, password,
        numConnections);
  }
468191
public SQLUnit generateSQL(final TableUnit tableUnit, final SQLBuilder sqlBuilder, final ShardingDataSourceMetaData shardingDataSourceMetaData) {
        return sqlBuilder.toSQL(tableUnit, getTableTokens(tableUnit), shardingRule, shardingDataSourceMetaData);
    }
116189
@Override
    public SqlInfo buildSqlInfo(BuildSource source) {
        // 判断是否生成，如果不匹配则不生成SQL片段.
        String matchText = XmlNodeHelper.getNodeAttrText(source.getNode(), ZealotConst.ATTR_MATCH);
        if (ParseHelper.isNotMatch(matchText, source.getParamObj())) {
            return source.getSqlInfo();
        }

        // 获取命名空间的文本值.
        String nameSpaceText = XmlNodeHelper.getNodeAttrText(source.getNode(), ZealotConst.ATTR_NAME_SPACE);
        String nameSpace = StringHelper.isNotBlank(nameSpaceText) ? nameSpaceText : source.getNameSpace();

        // 获取ZealotId的文本值.
        String zealotIdText = XmlNodeHelper.getNodeAttrText(source.getNode(), ZealotConst.ATTR_ZEALOT_ID);
        Node node = XmlNodeHelper.getNodeBySpaceAndId(nameSpace, zealotIdText);

        // 获取valueText值，如果valueText不为空，则视为将此valueText的解析值再次传入到引入的模板中作为新的上下文参数.
        String valueText = XmlNodeHelper.getNodeAttrText(source.getNode(), ZealotConst.ATTR_VALUE);
        if (StringHelper.isNotBlank(valueText)) {
            Object paramObj = ParseHelper.parseExpressWithException(valueText, source.getParamObj());
            return Zealot.buildSqlInfo(nameSpace, source.getSqlInfo(), node, paramObj);
        }

        // 使用默认参数对象传入到待解析的引入模板中.
        return Zealot.buildSqlInfo(nameSpace, source.getSqlInfo(), node, source.getParamObj());
    }
600135
public SpringApplicationBuilder sources(Class<?>... sources) {
		this.sources.addAll(new LinkedHashSet<>(Arrays.asList(sources)));
		return this;
	}
1121784
public static DataSource getDataSource(String source) {
		DataSource ds = dataSources.get(source);
		if (ds == null){
			synchronized (dataSourcesStructureLock){
				ds = dataSources.get(source);
				if (ds == null){
					ds = createDataSource(source);
					if (ds != null){
						dataSources.put(source, ds);
					}
				}
			}
		}
		return ds;
	}
209770
public void setSqlSource(MappedStatement ms) throws Exception {
        if (this.mapperClass == getMapperClass(ms.getId())) {
            throw new MapperException("请不要配置或扫描通用Mapper接口类：" + this.mapperClass);
        }
        Method method = methodMap.get(getMethodName(ms));
        try {
            //第一种，直接操作ms，不需要返回值
            if (method.getReturnType() == Void.TYPE) {
                method.invoke(this, ms);
            }
            //第二种，返回SqlNode
            else if (SqlNode.class.isAssignableFrom(method.getReturnType())) {
                SqlNode sqlNode = (SqlNode) method.invoke(this, ms);
                DynamicSqlSource dynamicSqlSource = new DynamicSqlSource(ms.getConfiguration(), sqlNode);
                setSqlSource(ms, dynamicSqlSource);
            }
            //第三种，返回xml形式的sql字符串
            else if (String.class.equals(method.getReturnType())) {
                String xmlSql = (String) method.invoke(this, ms);
                SqlSource sqlSource = createSqlSource(ms, xmlSql);
                //替换原有的SqlSource
                setSqlSource(ms, sqlSource);
            } else {
                throw new MapperException("自定义Mapper方法返回类型错误,可选的返回类型为void,SqlNode,String三种!");
            }
        } catch (IllegalAccessException e) {
            throw new MapperException(e);
        } catch (InvocationTargetException e) {
            throw new MapperException(e.getTargetException() != null ? e.getTargetException() : e);
        }
    }
895808
public static Builder newBuilder(TableId sourceTable, String destinationUri) {
    return newBuilder(sourceTable, ImmutableList.of(checkNotNull(destinationUri)));
  }
944109
@Override
  public String buildQuery() {
    validateQuery();

    StringBuilder stringBuilder = new StringBuilder();
    if (!Strings.isNullOrEmpty(select)) {
      stringBuilder = stringBuilder.append(SELECT).append(" ").append(select).append(" ");
    }
    if (!Strings.isNullOrEmpty(from)) {
      stringBuilder = stringBuilder.append(FROM).append(" ").append(from).append(" ");
    }
    if (!Strings.isNullOrEmpty(where)) {
      stringBuilder = stringBuilder.append(WHERE).append(" ").append(where).append(" ");
    }
    if (!Strings.isNullOrEmpty(orderBy)) {
      stringBuilder = stringBuilder.append(ORDER_BY).append(" ").append(orderBy).append(" ");
    }
    if (limit != null) {
      stringBuilder = stringBuilder.append(LIMIT).append(" ").append(limit).append(" ");
    }
    if (offset != null) {
      stringBuilder = stringBuilder.append(OFFSET).append(" ").append(offset).append(" ");
    }
    return stringBuilder.toString().trim();
  }
1149916
public static XmlSqlInfoBuilder newInstace(BuildSource source) {
        XmlSqlInfoBuilder builder = new XmlSqlInfoBuilder();
        builder.init(source);
        return builder;
    }
911567
public Object javaToSql(Object source)
    {
        if (source instanceof Boolean)
        {
            if (source.equals(Boolean.TRUE))
            {
                return I_TRUE;
            }
            else
            {
                return I_FALSE;
            }
        }
        else
        {
            return source;
        }
    }