當前位置: 首頁>>代碼示例>>Java>>正文


Java Properties.size方法代碼示例

本文整理匯總了Java中java.util.Properties.size方法的典型用法代碼示例。如果您正苦於以下問題:Java Properties.size方法的具體用法?Java Properties.size怎麽用?Java Properties.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Properties的用法示例。


在下文中一共展示了Properties.size方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readMessages

import java.util.Properties; //導入方法依賴的package包/類
private static void readMessages ()
{
  messages = new Properties ();
  Enumeration fileList = msgFiles.elements ();
  DataInputStream stream;
  while (fileList.hasMoreElements ())
    try
    {
      stream = FileLocator.locateLocaleSpecificFileInClassPath ((String)fileList.nextElement ());
      messages.load (stream);
    }
    catch (IOException e)
    {
    }
  if (messages.size () == 0)
    messages.put (defaultKey, "Error reading Messages File.");
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:18,代碼來源:Util.java

示例2: toString

import java.util.Properties; //導入方法依賴的package包/類
public static String toString(Properties p, String[] propOrder) {
    StringBuffer sb = new StringBuffer();

    if (p.size() > 1) {
        sb.append("{");
    }
    char[] convertBuf = new char[1024];
    for (int i = 0; i < propOrder.length; i++) {
        sb.append(escape(p.getProperty(propOrder[i]), convertBuf));
        if (i < propOrder.length - 1) {
            sb.append(", ");
        }
    }
    if (p.size() > 1) {
        sb.append("}");
    }
    return sb.toString();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:PropertyHelper.java

示例3: readParam

import java.util.Properties; //導入方法依賴的package包/類
private String readParam(Properties props, String paramName) {
    String paramValue = null;
    if (props.size() > 0) {
        paramValue = props.getProperty(CLIENTTESTS_XRAY_PROPERTIES_PREFIX + paramName);
    }
    if (paramValue == null) {
        paramValue = System.getProperty(CLIENTTESTS_XRAY_PROPERTIES_PREFIX + paramName);
    }
    if (paramValue == null) {
        paramValue = System.getenv(CLIENTTESTS_XRAY_ENV_VAR_PREFIX + paramName.toUpperCase());
    }
    if (paramValue == null) {
        failInit();
    }
    return paramValue;
}
 
開發者ID:JFrogDev,項目名稱:jfrog-idea-plugin,代碼行數:17,代碼來源:XrayTestsBase.java

示例4: propertiesToString

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Converts connection properties to a String to be passed to the mappers.
 * @param properties JDBC connection parameters
 * @return String to be passed to configuration
 */
protected static String propertiesToString(Properties properties) {
  List<String> propertiesList = new ArrayList<String>(properties.size());
  for(Entry<Object, Object> property : properties.entrySet()) {
    String key = StringEscapeUtils.escapeCsv(property.getKey().toString());
    if (key.equals(property.getKey().toString()) && key.contains("=")) {
      key = "\"" + key + "\"";
    }
    String val = StringEscapeUtils.escapeCsv(property.getValue().toString());
    if (val.equals(property.getValue().toString()) && val.contains("=")) {
      val = "\"" + val + "\"";
    }
    propertiesList.add(StringEscapeUtils.escapeCsv(key + "=" + val));
  }
  return StringUtils.join(propertiesList, ',');
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:21,代碼來源:DBConfiguration.java

示例5: convert

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Convert Properties to a Map with String keys and String values.
 *
 * @param properties the properties object
 * @return the equivalent {@code Map<String,String>}
 */
public static Map<String, String> convert(Properties properties) {
	Map<String, String> result = new HashMap<>(properties.size());
	for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) {
		String key = (String) e.nextElement();
		result.put(key, properties.getProperty(key));
	}
	return result;
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-skipper,代碼行數:15,代碼來源:DeploymentPropertiesUtils.java

示例6: createCacheClient

import java.util.Properties; //導入方法依賴的package包/類
public static void createCacheClient(Pool poolAttr, String regionName, Properties dsProperties,
    Boolean addControlListener, Properties javaSystemProperties) throws Exception {
  new CacheServerTestUtil().createCache(dsProperties);
  IgnoredException.addIgnoredException("java.net.ConnectException||java.net.SocketException");

  if (javaSystemProperties != null && javaSystemProperties.size() > 0) {
    Enumeration e = javaSystemProperties.propertyNames();

    while (e.hasMoreElements()) {
      String key = (String) e.nextElement();
      System.setProperty(key, javaSystemProperties.getProperty(key));
    }
  }

  PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory();
  pf.init(poolAttr);
  PoolImpl p = (PoolImpl) pf.create("CacheServerTestUtil");
  AttributesFactory factory = new AttributesFactory();
  factory.setScope(Scope.LOCAL);
  factory.setPoolName(p.getName());
  if (addControlListener.booleanValue()) {
    factory.addCacheListener(new ControlListener());
  }
  RegionAttributes attrs = factory.create();
  cache.createRegion(regionName, attrs);
  pool = p;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:28,代碼來源:CacheServerTestUtil.java

示例7: createCacheClient

import java.util.Properties; //導入方法依賴的package包/類
public static void createCacheClient(Pool poolAttr, String regionName,
                                     Properties dsProperties, Boolean addControlListener, Properties javaSystemProperties) throws Exception {
  new CacheServerTestUtil("temp").createCache(dsProperties);
  addExpectedException("java.net.ConnectException||java.net.SocketException");

  if (javaSystemProperties != null && javaSystemProperties.size() > 0) {
    Enumeration e = javaSystemProperties.propertyNames();

    while (e.hasMoreElements()) {
      String key = (String) e.nextElement();
      System.setProperty(key, javaSystemProperties.getProperty(key));
    }
  }

  PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
  pf.init(poolAttr);
  PoolImpl p = (PoolImpl)pf.create("CacheServerTestUtil");
  AttributesFactory factory = new AttributesFactory();
  factory.setScope(Scope.LOCAL);
  factory.setPoolName(p.getName());
  if (addControlListener.booleanValue()) {
    factory.addCacheListener(new ControlListener());
  }
  RegionAttributes attrs = factory.create();
  cache.createRegion(regionName, attrs);
  pool = p;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:28,代碼來源:CacheServerTestUtil.java

示例8: createQueryParameters

import java.util.Properties; //導入方法依賴的package包/類
public static List<NameValuePair> createQueryParameters(Properties queryParams){
    if (queryParams == null || queryParams.size() == 0) {
        return Collections.EMPTY_LIST;
    }
    List<NameValuePair> params = new ArrayList<NameValuePair>();

    for (String propName : queryParams.stringPropertyNames()) {
        params.add(new BasicNameValuePair(propName, queryParams.getProperty(propName)));
    }
    return params;
}
 
開發者ID:bubicn,項目名稱:bubichain-sdk-java,代碼行數:12,代碼來源:RequestUtils.java

示例9: parseRules

import java.util.Properties; //導入方法依賴的package包/類
private RandomMobsRule[] parseRules(Properties p_parseRules_1_, ResourceLocation p_parseRules_2_, ConnectedParser p_parseRules_3_)
{
    List list = new ArrayList();
    int i = p_parseRules_1_.size();

    for (int j = 0; j < i; ++j)
    {
        int k = j + 1;
        String s = p_parseRules_1_.getProperty("skins." + k);

        if (s != null)
        {
            int[] aint = p_parseRules_3_.parseIntList(s);
            int[] aint1 = p_parseRules_3_.parseIntList(p_parseRules_1_.getProperty("weights." + k));
            Biome[] abiome = p_parseRules_3_.parseBiomes(p_parseRules_1_.getProperty("biomes." + k));
            RangeListInt rangelistint = p_parseRules_3_.parseRangeListInt(p_parseRules_1_.getProperty("heights." + k));

            if (rangelistint == null)
            {
                rangelistint = this.parseMinMaxHeight(p_parseRules_1_, k);
            }

            RandomMobsRule randommobsrule = new RandomMobsRule(p_parseRules_2_, aint, aint1, abiome, rangelistint);
            list.add(randommobsrule);
        }
    }

    RandomMobsRule[] arandommobsrule = (RandomMobsRule[])((RandomMobsRule[])list.toArray(new RandomMobsRule[list.size()]));
    return arandommobsrule;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:31,代碼來源:RandomMobsProperties.java

示例10: toArray

import java.util.Properties; //導入方法依賴的package包/類
@TargetApi(9)
public static String toArray(Properties properties) {
    if (properties != null && properties.size() > 0) {
        String[] result = new String[properties.size()];
        int index = 0;
        properties.toString();

        String key;
        for (Iterator i$ = properties.stringPropertyNames().iterator(); i$.hasNext(); result[index++] = key + properties.getProperty(key)) {
            key = (String) i$.next();
        }
    }

    return null;
}
 
開發者ID:alibaba,項目名稱:LuaViewPlayground,代碼行數:16,代碼來源:PropUtil.java

示例11: unsetJavaSystemProperties

import java.util.Properties; //導入方法依賴的package包/類
public static void unsetJavaSystemProperties(Properties javaSystemProperties) {
  if (javaSystemProperties != null && javaSystemProperties.size() > 0) {
    Enumeration e = javaSystemProperties.propertyNames();

    while (e.hasMoreElements()) {
      String key = (String) e.nextElement();
      System.clearProperty(key);
    }
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:11,代碼來源:CacheServerTestUtil.java

示例12: createInitialContext

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Create a new JNDI initial context. Invoked by {@link #getContext}.
 * <p>The default implementation use this template's environment settings.
 * Can be subclassed for custom contexts, e.g. for testing.
 * @return the initial Context instance
 * @throws NamingException in case of initialization errors
 */
protected Context createInitialContext() throws NamingException {
	Hashtable<?, ?> icEnv = null;
	Properties env = getEnvironment();
	if (env != null) {
		icEnv = new Hashtable<Object, Object>(env.size());
		CollectionUtils.mergePropertiesIntoMap(env, icEnv);
	}
	return new InitialContext(icEnv);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:JndiTemplate.java

示例13: resolveInterfaceMappings

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Resolve the given interface mappings, turning class names into Class objects.
 * @param mappings the specified interface mappings
 * @return the resolved interface mappings (with Class objects as values)
 */
private Map<String, Class<?>[]> resolveInterfaceMappings(Properties mappings) {
	Map<String, Class<?>[]> resolvedMappings = new HashMap<String, Class<?>[]>(mappings.size());
	for (Enumeration<?> en = mappings.propertyNames(); en.hasMoreElements();) {
		String beanKey = (String) en.nextElement();
		String[] classNames = StringUtils.commaDelimitedListToStringArray(mappings.getProperty(beanKey));
		Class<?>[] classes = resolveClassNames(classNames, beanKey);
		resolvedMappings.put(beanKey, classes);
	}
	return resolvedMappings;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:16,代碼來源:InterfaceBasedMBeanInfoAssembler.java

示例14: convert

import java.util.Properties; //導入方法依賴的package包/類
/**
 * Convert Properties to a Map with String keys and values. Entries whose key or value is not a String are omitted.
 */
public static Map<String, String> convert(Properties properties) {
	Map<String, String> result  = new HashMap<>(properties.size());
	for (String key : properties.stringPropertyNames()) {
		result.put(key, properties.getProperty(key));
	}
	return result;
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-dashboard,代碼行數:11,代碼來源:DeploymentPropertiesUtils.java

示例15: makeConnection

import java.util.Properties; //導入方法依賴的package包/類
/**
   * Create a connection to the database; usually used only from within
   * getConnection(), which enforces a singleton guarantee around the
   * Connection object.
   */
  protected Connection makeConnection() throws SQLException, Exception {

    Connection connection;
    String driverClass = getDriverClass();

    try {
      Class.forName(driverClass);
    } catch (ClassNotFoundException cnfe) {
      throw new RuntimeException("Could not load db driver class: "
          + driverClass);
    }

    String username = options.getString(DBConfiguration.DataSourceInfo.USERNAME_PROPERTY);
    String password = options.getString(DBConfiguration.DataSourceInfo.PASSWORD_PROPERTY);
//    String connectString = options.getString(DBConfiguration.DataSourceInfo.URL_PROPERTY_READ_ONLY);
//    if(!readOnly){
//        connectString = (String)(options.get(DBConfiguration.DataSourceInfo.URL_PROPERTY_READ_WRITE));
//    }
    String connectionParamsStr = options.getString(DBConfiguration.CONNECTION_PARAMS_PROPERTY);
    Properties connectionParams = DBConfiguration.propertiesFromString(connectionParamsStr);
     
    if (connectionParams != null && connectionParams.size() > 0) {
      LOG.debug("User specified connection params. "
              + "Using properties specific API for making connection.");
      
      Properties props = new Properties();
      if (username != null) {
        props.put("user", username);
      }

      if (password != null) {
        props.put("password", password);
      }

      props.putAll(connectionParams);
      connection = DriverManager.getConnection(this.conString, props);
    } else {
      LOG.debug("No connection paramenters specified. "
              + "Using regular API for making connection.");
      if (username == null) {
        connection = DriverManager.getConnection(this.conString);
      } else {
        connection = DriverManager.getConnection(
                        this.conString, username, password);
      }
    }

    // We only use this for metadata queries. Loosest semantics are okay.
    connection.setTransactionIsolation(getMetadataIsolationLevel());
    connection.setAutoCommit(false);

    return connection;
  }
 
開發者ID:BriData,項目名稱:DBus,代碼行數:59,代碼來源:SqlManager.java


注:本文中的java.util.Properties.size方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。