当前位置: 首页>>代码示例>>Java>>正文


Java StrUtils.parseBool方法代码示例

本文整理汇总了Java中org.apache.solr.common.util.StrUtils.parseBool方法的典型用法代码示例。如果您正苦于以下问题:Java StrUtils.parseBool方法的具体用法?Java StrUtils.parseBool怎么用?Java StrUtils.parseBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.common.util.StrUtils的用法示例。


在下文中一共展示了StrUtils.parseBool方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
@Override
public void init(NamedList args) {
  if (args != null) {
    Object val = args.get("inOrder");
    if (val != null) {
      inOrder = StrUtils.parseBool(val.toString());
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:10,代码来源:ComplexPhraseQParserPlugin.java

示例2: isEnabled

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
private boolean isEnabled( NamedList params ){
  if( params == null ) return false;
  Object enable = params.get( "enable" );
  if( enable == null ) return true;
  if( enable instanceof String )
    return StrUtils.parseBool( (String)enable );
  return Boolean.TRUE.equals( enable );
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:ReplicationHandler.java

示例3: getBool

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
/** Returns the Boolean value of the param, or null if not set */
public Boolean getBool(String param) {
    String val = get(param);
    return val==null ? null : StrUtils.parseBool(val);
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:6,代码来源:SolrParams.java

示例4: getFieldBool

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
/** Returns the Boolean value of the field param,
 or the value for param, or null if neither is set. */
public Boolean getFieldBool(String field, String param) {
    String val = getFieldParam(field, param);
    return val==null ? null : StrUtils.parseBool(val);
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:7,代码来源:SolrParams.java

示例5: getBool

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
/** Returns the Boolean value of the param, or null if not set */
public Boolean getBool(String param) {
  String val = get(param);
  return val==null ? null : StrUtils.parseBool(val);
}
 
开发者ID:europeana,项目名称:search,代码行数:6,代码来源:SolrParams.java

示例6: getFieldBool

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
/** Returns the Boolean value of the field param, 
    or the value for param, or null if neither is set. */
public Boolean getFieldBool(String field, String param) {
  String val = getFieldParam(field, param);
  return val==null ? null : StrUtils.parseBool(val);
}
 
开发者ID:europeana,项目名称:search,代码行数:7,代码来源:SolrParams.java

示例7: RequestInfo

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
public RequestInfo(SolrQueryRequest request, Map<String,Object> requestParams, ContentStream stream) {
  this.request = request;
  this.contentStream = stream;    
  if (requestParams.containsKey("command")) { 
    command = (String) requestParams.get("command");
  } else {
    command = null;
  }    
  boolean debugMode = StrUtils.parseBool((String) requestParams.get("debug"), false);    
  if (debugMode) {
    debug = true;
    debugInfo = new DebugInfo(requestParams);
  } else {
    debug = false;
    debugInfo = null;
  }       
  if (requestParams.containsKey("clean")) {
    clean = StrUtils.parseBool( (String) requestParams.get("clean"), true);
  } else if (DataImporter.DELTA_IMPORT_CMD.equals(command) || DataImporter.IMPORT_CMD.equals(command)) {
    clean = false;
  } else  {
    clean = debug ? false : true;
  }    
  optimize = StrUtils.parseBool((String) requestParams.get("optimize"), false);
  if(optimize) {
    commit = true;
  } else {
    commit = StrUtils.parseBool( (String) requestParams.get("commit"), (debug ? false : true));
  }      
  if (requestParams.containsKey("rows")) {
    rows = Integer.parseInt((String) requestParams.get("rows"));
  } else {
    rows = debug ? 10 : Long.MAX_VALUE;
  }      
  
  if (requestParams.containsKey("start")) {
    start = Integer.parseInt((String) requestParams.get("start"));
  } else {
    start = 0;
  }
  syncMode = StrUtils.parseBool((String) requestParams.get("synchronous"), false);    
  
  Object o = requestParams.get("entity");     
  List<String> modifiableEntities = null;
  if(o != null) {
    if (o instanceof String) {
      modifiableEntities = new ArrayList<>();
      modifiableEntities.add((String) o);
    } else if (o instanceof List<?>) {
      @SuppressWarnings("unchecked")
      List<String> modifiableEntities1 = new ArrayList<>((List<String>) o);
      modifiableEntities = modifiableEntities1;
    } 
    entitiesToRun = Collections.unmodifiableList(modifiableEntities);
  } else {
    entitiesToRun = null;
  }
  String configFileParam = (String) requestParams.get("config");
  configFile = configFileParam;
  String dataConfigParam = (String) requestParams.get("dataConfig");
  if (dataConfigParam != null && dataConfigParam.trim().length() == 0) {
    // Empty data-config param is not valid, change it to null
    dataConfigParam = null;
  }
  dataConfig = dataConfigParam;
  this.rawParams = Collections.unmodifiableMap(new HashMap<>(requestParams));
}
 
开发者ID:europeana,项目名称:search,代码行数:68,代码来源:RequestInfo.java

示例8: DebugInfo

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
public DebugInfo(Map<String,Object> requestParams) {
  verbose = StrUtils.parseBool((String) requestParams.get("verbose"), false);
  debugVerboseOutput = new NamedList<>();
}
 
开发者ID:europeana,项目名称:search,代码行数:5,代码来源:DebugInfo.java

示例9: addToNamedList

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
/**
 * Examines a Node from the DOM representation of a NamedList and adds the
 * contents of that node to both the specified NamedList and List passed
 * as arguments.
 *
 * @param nd The Node whose type will be used to determine how to parse the
 *           text content.  If there is a 'name' attribute it will be used
 *           when adding to the NamedList
 * @param nlst A NamedList to add the item to with name if application.
 *             If this param is null it will be ignored.
 * @param arr A List to add the item to.
 *             If this param is null it will be ignored.
 */
@SuppressWarnings("unchecked")
public static void addToNamedList(Node nd, NamedList nlst, List arr) {
  // Nodes often include whitespace, etc... so just return if this
  // is not an Element.
  if (nd.getNodeType() != Node.ELEMENT_NODE) return;

  final String type = nd.getNodeName();

  final String name = getAttr(nd, "name");

  Object val=null;

  if ("lst".equals(type)) {
    val = childNodesToNamedList(nd);
  } else if ("arr".equals(type)) {
    val = childNodesToList(nd);
  } else {
    final String textValue = getText(nd);
    try {
      if ("str".equals(type)) {
        val = textValue;
      } else if ("int".equals(type)) {
        val = Integer.valueOf(textValue);
      } else if ("long".equals(type)) {
        val = Long.valueOf(textValue);
      } else if ("float".equals(type)) {
        val = Float.valueOf(textValue);
      } else if ("double".equals(type)) {
        val = Double.valueOf(textValue);
      } else if ("bool".equals(type)) {
        val = StrUtils.parseBool(textValue);
      }
      // :NOTE: Unexpected Node names are ignored
      // :TODO: should we generate an error here?
    } catch (NumberFormatException nfe) {
      throw new SolrException
        (SolrException.ErrorCode.SERVER_ERROR,
         "Value " + (null != name ? ("of '" +name+ "' ") : "") +
         "can not be parsed as '" +type+ "': \"" + textValue + "\"",
         nfe);
    }
  }

  if (nlst != null) nlst.add(name,val);
  if (arr != null) arr.add(val);
}
 
开发者ID:europeana,项目名称:search,代码行数:60,代码来源:DOMUtil.java

示例10: getBool

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
/** Returns the boolean value of the param, or def if not set */
public boolean getBool(String param, boolean def) {
  String val = get(param);
  return val==null ? def : StrUtils.parseBool(val);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:6,代码来源:SolrParams.java

示例11: RequestInfo

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
public RequestInfo(Map<String,Object> requestParams, ContentStream stream) {
  this.contentStream = stream;    
  if (requestParams.containsKey("command")) { 
    command = (String) requestParams.get("command");
  } else {
    command = null;
  }    
  boolean debugMode = StrUtils.parseBool((String) requestParams.get("debug"), false);    
  if (debugMode) {
    debug = true;
    debugInfo = new DebugInfo(requestParams);
  } else {
    debug = false;
    debugInfo = null;
  }       
  if (requestParams.containsKey("clean")) {
    clean = StrUtils.parseBool( (String) requestParams.get("clean"), true);
  } else if (DataImporter.DELTA_IMPORT_CMD.equals(command) || DataImporter.IMPORT_CMD.equals(command)) {
    clean = false;
  } else  {
    clean = debug ? false : true;
  }    
  optimize = StrUtils.parseBool((String) requestParams.get("optimize"), false);
  if(optimize) {
    commit = true;
  } else {
    commit = StrUtils.parseBool( (String) requestParams.get("commit"), (debug ? false : true));
  }      
  if (requestParams.containsKey("rows")) {
    rows = Integer.parseInt((String) requestParams.get("rows"));
  } else {
    rows = debug ? 10 : Long.MAX_VALUE;
  }      
  
  if (requestParams.containsKey("start")) {
    start = Integer.parseInt((String) requestParams.get("start"));
  } else {
    start = 0;
  }
  syncMode = StrUtils.parseBool((String) requestParams.get("synchronous"), false);    
  
  Object o = requestParams.get("entity");     
  List<String> modifiableEntities = null;
  if(o != null) {
    if (o instanceof String) {
      modifiableEntities = new ArrayList<String>();
      modifiableEntities.add((String) o);
    } else if (o instanceof List<?>) {
      @SuppressWarnings("unchecked")
      List<String> modifiableEntities1 = new ArrayList<String>((List<String>) o);
      modifiableEntities = modifiableEntities1;
    } 
    entitiesToRun = Collections.unmodifiableList(modifiableEntities);
  } else {
    entitiesToRun = null;
  }
  String configFileParam = (String) requestParams.get("config");
  configFile = configFileParam;
  String dataConfigParam = (String) requestParams.get("dataConfig");
  if (dataConfigParam != null && dataConfigParam.trim().length() == 0) {
    // Empty data-config param is not valid, change it to null
    dataConfigParam = null;
  }
  dataConfig = dataConfigParam;
  this.rawParams = Collections.unmodifiableMap(new HashMap<String,Object>(requestParams));
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:67,代码来源:RequestInfo.java

示例12: DebugInfo

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
public DebugInfo(Map<String,Object> requestParams) {
  verbose = StrUtils.parseBool((String) requestParams.get("verbose"), false);
  debugVerboseOutput = new NamedList<String>();
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:5,代码来源:DebugInfo.java

示例13: getFieldBool

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
/** Returns the boolean value of the field param, 
or the value for param, or def if neither is set. */
public boolean getFieldBool(String field, String param, boolean def) {
  String val = getFieldParam(field, param);
  return val==null ? def : StrUtils.parseBool(val);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:7,代码来源:SolrParams.java

示例14: RequestInfo

import org.apache.solr.common.util.StrUtils; //导入方法依赖的package包/类
public RequestInfo(SolrQueryRequest request, Map<String,Object> requestParams, ContentStream stream) {
  this.request = request;
  this.contentStream = stream;    
  if (requestParams.containsKey("command")) { 
    command = (String) requestParams.get("command");
  } else {
    command = null;
  }    
  boolean debugMode = StrUtils.parseBool((String) requestParams.get("debug"), false);    
  if (debugMode) {
    debug = true;
    debugInfo = new DebugInfo(requestParams);
  } else {
    debug = false;
    debugInfo = null;
  }       
  if (requestParams.containsKey("clean")) {
    clean = StrUtils.parseBool( (String) requestParams.get("clean"), true);
  } else if (DataImporter.DELTA_IMPORT_CMD.equals(command) || DataImporter.IMPORT_CMD.equals(command)) {
    clean = false;
  } else  {
    clean = debug ? false : true;
  }    
  optimize = StrUtils.parseBool((String) requestParams.get("optimize"), false);
  if(optimize) {
    commit = true;
  } else {
    commit = StrUtils.parseBool( (String) requestParams.get("commit"), (debug ? false : true));
  }      
  if (requestParams.containsKey("rows")) {
    rows = Integer.parseInt((String) requestParams.get("rows"));
  } else {
    rows = debug ? 10 : Long.MAX_VALUE;
  }      
  
  if (requestParams.containsKey("start")) {
    start = Integer.parseInt((String) requestParams.get("start"));
  } else {
    start = 0;
  }
  syncMode = StrUtils.parseBool((String) requestParams.get("synchronous"), false);    
  
  Object o = requestParams.get("entity");     
  List<String> modifiableEntities = null;
  if(o != null) {
    if (o instanceof String) {
      modifiableEntities = new ArrayList<String>();
      modifiableEntities.add((String) o);
    } else if (o instanceof List<?>) {
      @SuppressWarnings("unchecked")
      List<String> modifiableEntities1 = new ArrayList<String>((List<String>) o);
      modifiableEntities = modifiableEntities1;
    } 
    entitiesToRun = Collections.unmodifiableList(modifiableEntities);
  } else {
    entitiesToRun = null;
  }
  String configFileParam = (String) requestParams.get("config");
  configFile = configFileParam;
  String dataConfigParam = (String) requestParams.get("dataConfig");
  if (dataConfigParam != null && dataConfigParam.trim().length() == 0) {
    // Empty data-config param is not valid, change it to null
    dataConfigParam = null;
  }
  dataConfig = dataConfigParam;
  this.rawParams = Collections.unmodifiableMap(new HashMap<String,Object>(requestParams));
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:68,代码来源:RequestInfo.java


注:本文中的org.apache.solr.common.util.StrUtils.parseBool方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。