com.hortonworks.registries.common.QueryParam.getValue()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(83)

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

QueryParam.getValue介绍

暂无

代码示例

代码示例来源:origin: hortonworks/registry

private List<OrderByField> getOrderByFields(List<QueryParam> queryParams) {
  if (queryParams == null || queryParams.isEmpty()) {
    return Collections.emptyList();
  }
  List<OrderByField> orderByFields = new ArrayList<>();
  for (QueryParam queryParam : queryParams) {
    if (ORDER_BY_FIELDS_PARAM_NAME.equals(queryParam.getName())) {
      // _orderByFields=[<field-name>,<a/d>,]*
      // example can be : _orderByFields=foo,a,bar,d
      // order by foo with ascending then bar with descending
      String value = queryParam.getValue();
      String[] splitStrings = value.split(",");
      for (int i = 0; i < splitStrings.length; i += 2) {
        String ascStr = splitStrings[i + 1];
        boolean descending;
        if ("a".equals(ascStr)) {
          descending = false;
        } else if ("d".equals(ascStr)) {
          descending = true;
        } else {
          throw new IllegalArgumentException("Ascending or Descending identifier can only be 'a' or 'd' respectively.");
        }
        orderByFields.add(OrderByField.of(splitStrings[i], descending));
      }
    }
  }
  return orderByFields;
}

代码示例来源:origin: hortonworks/streamline

private Collection<TopologyComponentBundle> listCustomProcessorBundlesWithFilter(List<QueryParam> params) throws IOException {
  List<QueryParam> queryParamsForTopologyComponent = new ArrayList<>();
  queryParamsForTopologyComponent.add(new QueryParam(TopologyComponentBundle.SUB_TYPE, TopologyLayoutConstants.JSON_KEY_CUSTOM_PROCESSOR_SUB_TYPE));
  for (QueryParam qp : params) {
    if (qp.getName().equals(TopologyComponentBundle.STREAMING_ENGINE)) {
      queryParamsForTopologyComponent.add(qp);
    }
  }
  Collection<TopologyComponentBundle> customProcessors = this.listTopologyComponentBundlesForTypeWithFilter(TopologyComponentBundle.TopologyComponentType
      .PROCESSOR, queryParamsForTopologyComponent);
  Collection<TopologyComponentBundle> result = new ArrayList<>();
  for (TopologyComponentBundle cp : customProcessors) {
    Map<String, Object> config = new HashMap<>();
    for (ComponentUISpecification.UIField uiField: cp.getTopologyComponentUISpecification().getFields()) {
      config.put(uiField.getFieldName(), uiField.getDefaultValue());
    }
    boolean matches = true;
    for (QueryParam qp : params) {
      if (!qp.getName().equals(TopologyComponentBundle.STREAMING_ENGINE) && !qp.getValue().equals(config.get(qp.getName()))) {
        matches = false;
        break;
      }
    }
    if (matches) {
      result.add(cp);
    }
  }
  return result;
}

代码示例来源:origin: hortonworks/registry

} else {
  fieldsToVal.put(new Schema.Field(qp.getName(), type),
      type.getJavaType().getConstructor(String.class).newInstance(qp.getValue()));

代码示例来源:origin: com.hortonworks.registries/storage-core

log.warn("Query parameter [{}] does not exist for namespace [{}]. Query parameter ignored.", qp.getName(), namespace);
} else {
  final String val = qp.getValue();
  final Schema.Type typeOfVal = Schema.Type.getTypeOfVal(val);
  fieldsToVal.put(new Schema.Field(qp.getName(), typeOfVal),

相关文章