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


Java Properties.keySet方法代碼示例

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


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

示例1: readProperties

import java.util.Properties; //導入方法依賴的package包/類
private Properties readProperties(Vector <? extends Property> antProperties) throws IOException {
    Properties props = new Properties();
    for(Property prop : antProperties) {
        if(prop.getName()!=null) {
            if(prop.getValue()!=null) {
                props.setProperty(prop.getName(), prop.getValue());
            } else if(prop.getLocation()!=null) {
                props.setProperty(prop.getName(),
                        new File(prop.getLocation().getFileName()).getAbsolutePath());
            }
        } else if(prop.getFile()!=null || prop.getUrl()!=null) {
            InputStream is = null;
            try {
                is = (prop.getFile()!=null) ?
                    new FileInputStream(prop.getFile()) :
                    prop.getUrl().openStream();
                
                Properties loadedProps = new Properties();
                loadedProps.load(is);
                is.close();
                if ( prop.getPrefix() != null ) {
                    for(Object p : loadedProps.keySet()) {
                        props.setProperty(prop.getPrefix() + p,
                                loadedProps.getProperty(p.toString()));
                    }
                } else {
                    props.putAll(loadedProps);
                }
            } finally {
                if (is != null) {
                    is.close();
                }
            }
        }
    }
    
    return props;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:39,代碼來源:CreateBundle.java

示例2: loadConnectionProps

import java.util.Properties; //導入方法依賴的package包/類
private void loadConnectionProps(Properties props) {
    if (props != null) {
        for (Object key : props.keySet()) {
            String propsKey = (String) key;
            if (components.containsKey(propsKey)) {
                JComponent component = components.get(propsKey);
                String value = props.getProperty(propsKey);
                if (component instanceof JTextField) {
                    ((JTextField) component).setText(value);
                } else if (component instanceof JComboBox) {
                    ((JComboBox) component).setSelectedItem(value);
                }
            }
        }
    }
}
 
開發者ID:maoling,項目名稱:fuck_zookeeper,代碼行數:17,代碼來源:ZooInspectorConnectionPropertiesDialog.java

示例3: expectBindingFailure

import java.util.Properties; //導入方法依賴的package包/類
public void expectBindingFailure(URI fsURI, Configuration config) {
  try {
    Properties binding = RestClientBindings.bind(fsURI, config);
    //if we get here, binding didn't fail- there is something else.
    //list the properties but not the values.
    StringBuilder details = new StringBuilder() ;
    for (Object key: binding.keySet()) {
      details.append(key.toString()).append(" ");
    }
    fail("Expected a failure, got the binding [ "+ details+"]");
  } catch (SwiftConfigurationException expected) {

  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:15,代碼來源:TestRestClientBindings.java

示例4: readMapColors

import java.util.Properties; //導入方法依賴的package包/類
private static int[] readMapColors(Properties p_readMapColors_0_, String p_readMapColors_1_, String p_readMapColors_2_, String p_readMapColors_3_)
{
    int[] aint = new int[MapColor.COLORS.length];
    Arrays.fill((int[])aint, (int) - 1);
    int i = 0;

    for (Object s0 : p_readMapColors_0_.keySet())
    {
    	String s = (String) s0;
        String s1 = p_readMapColors_0_.getProperty(s);

        if (s.startsWith(p_readMapColors_2_))
        {
            String s2 = StrUtils.removePrefix(s, p_readMapColors_2_);
            int j = getMapColorIndex(s2);
            int k = parseColor(s1);

            if (j >= 0 && j < aint.length && k >= 0)
            {
                aint[j] = k;
                ++i;
            }
            else
            {
                warn("Invalid color: " + s + " = " + s1);
            }
        }
    }

    if (i <= 0)
    {
        return null;
    }
    else
    {
        dbg(p_readMapColors_3_ + " colors: " + i);
        return aint;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:40,代碼來源:CustomColors.java

示例5: retrieveStandAloneEnvProperties

import java.util.Properties; //導入方法依賴的package包/類
/**
 * This method retrieves all properties from the StandAloneEnvProperties
 * file
 **/
protected static void retrieveStandAloneEnvProperties() {
	configPath = "./src/test/resources/configuration/config.properties";

	Properties prop = FileUtilityManager.getProperties(configPath);

	Set<Object> set = prop.keySet();

	Iterator<Object> it = set.iterator();

	for (int i = 0; i < set.size(); i++) {
		String key = (String) it.next();

		if (key.equalsIgnoreCase("desktopUrl")) {
			desktopUrl = prop.getProperty(key);
		} else if (key.equalsIgnoreCase("deviceUrl")) {
			deviceUrl = prop.getProperty(key);
		} else if (key.equalsIgnoreCase("platformName")) {
			platformName = prop.getProperty(key);
		} else if (key.equalsIgnoreCase("platformVersion")) {
			platformVersion = prop.getProperty(key);
		} else if (key.equalsIgnoreCase("automationName")) {
			automationName = prop.getProperty(key);
		} else if (key.equalsIgnoreCase("deviceName")) {
			deviceName = prop.getProperty(key);
		} else if (key.equalsIgnoreCase("noReset")) {
			noReset = prop.getProperty(key);
		} else if (key.equalsIgnoreCase("fullReset")) {
			fullReset = prop.getProperty(key);
		} else if (key.equalsIgnoreCase("app")) {
			app = prop.getProperty(key);
		} else if (key.equalsIgnoreCase("device")) {
			device = prop.getProperty(key);
		} else
			continue;
	}
}
 
開發者ID:AnujDasari,項目名稱:Actitime-Framework,代碼行數:41,代碼來源:DriverManager.java

示例6: readPotionColors

import java.util.Properties; //導入方法依賴的package包/類
private static int[] readPotionColors(Properties p_readPotionColors_0_, String p_readPotionColors_1_, String p_readPotionColors_2_, String p_readPotionColors_3_)
{
    int[] aint = new int[Potion.potionTypes.length];
    Arrays.fill((int[])aint, (int) - 1);
    int i = 0;

    for (Object s : p_readPotionColors_0_.keySet())
    {
        String s1 = p_readPotionColors_0_.getProperty((String) s);

        if (((String) s).startsWith(p_readPotionColors_2_))
        {
            int j = getPotionId((String) s);
            int k = parseColor(s1);

            if (j >= 0 && j < aint.length && k >= 0)
            {
                aint[j] = k;
                ++i;
            }
            else
            {
                warn("Invalid color: " + s + " = " + s1);
            }
        }
    }

    if (i <= 0)
    {
        return null;
    }
    else
    {
        dbg(p_readPotionColors_3_ + " colors: " + i);
        return aint;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:38,代碼來源:CustomColors.java

示例7: mergeIfExist

import java.util.Properties; //導入方法依賴的package包/類
private void mergeIfExist(Properties from, Properties to) {
    for (Object key : from.keySet()) {
        if (!to.containsKey(key)) {
            continue;
        }

        Object fromObj = from.get(key), toObj = to.get(key);
        if (toObj != null && !toObj.equals(fromObj)) {
            log.info("Replace, key: {}, value: {} -> {}", key, toObj, fromObj);
        }
        to.put(key, fromObj);
    }
}
 
開發者ID:lyy4j,項目名稱:rmq4note,代碼行數:14,代碼來源:Configuration.java

示例8: getPropertyAndPropOderControl

import java.util.Properties; //導入方法依賴的package包/類
private static void getPropertyAndPropOderControl(Properties properties, Set<String> propNames, Set<String> propOrderControl)
{

    for (Object propKeyObj : properties.keySet())
    {
        String propKey = (String) propKeyObj;

        // Find end of property control (default/custom) flag
        int propOrderControlEndDot = propKey.indexOf('.');
        if (propOrderControlEndDot < 1)
        {
            logger.debug("Ignoring property: " + propKey);
            continue;
        }
        int propKeyLength = propKey.length();

        int propNameLength = (propKeyLength - propOrderControlEndDot) -1; // Length of characters between dots
        if (propNameLength  < 1)
        {
            logger.debug("Ignoring property: " + propKey);
            continue;
        }
        String orderControl = propKey.substring(0, propOrderControlEndDot);
        String propName = propKey.substring((propOrderControlEndDot + 1));

        // Add them
        propOrderControl.add(orderControl);
        propNames.add(propName);
    }
    // Done
    if (logger.isDebugEnabled())
    {
        logger.debug("All property order controls: " + propOrderControl);
        logger.debug("All properties: " + propNames);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:37,代碼來源:SolrFacetConfig.java

示例9: checkAreAllItemsTranslated

import java.util.Properties; //導入方法依賴的package包/類
/**
 * check the imported properties are all translated
 * 
 * @param propertiesMap
 *            map contains default language properties and imported language
 *            properties
 * @param defaultLanguageCode
 *            language code of default language
 * @param importLanguageCode
 *            language code of imported language
 * @return
 * @throws PropertiesImportException
 *             - exception while import properties
 * @throws ObjectNotFoundException
 *             - exception if there is no default language in system
 */
@RolesAllowed({ "PLATFORM_OPERATOR" })
public String checkAreAllItemsTranslated(
        List<Map<String, Properties>> propertiesMaps,
        String importLanguageCode) throws PropertiesImportException,
        ObjectNotFoundException {
    String defaultLanguageCode = getDefaultLanguage()
            + StandardLanguage.COLUMN_HEADING_SUFFIX;
    for (Map<String, Properties> propertiesMap : propertiesMaps) {
        Properties defaultLanguageProperties = propertiesMap
                .get(defaultLanguageCode);
        Properties importLanguageProperties = propertiesMap
                .get(importLanguageCode);
        Set<Object> keys = defaultLanguageProperties.keySet();
        for (Object key : keys) {
            String defaultPropertyValue = defaultLanguageProperties
                    .get(key.toString()).toString().trim();
            if (defaultPropertyValue.length() == 0) {
                continue;
            }
            if (importLanguageProperties.containsKey(key)) {
                Object importPropertyValue = importLanguageProperties
                        .get(key.toString());
                if (importPropertyValue != null
                        && importPropertyValue.toString().length() > 0) {
                    continue;
                }
            }
            PropertiesImportException propertiesImportException = new PropertiesImportException(
                    PropertiesImportException.Reason.TRANSLATIONS_MISSING);
            logger.logWarn(
                    Log4jLogger.SYSTEM_LOG,
                    propertiesImportException,
                    LogMessageIdentifier.WARN_TRANSLATIONS_MISSING_FOR_IMPORT_PROPERTIES);
            return propertiesImportException.getMessageKey();
        }
    }

    return null;
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:56,代碼來源:OperatorServiceLocalBean.java

示例10: addTestsFromStream

import java.util.Properties; //導入方法依賴的package包/類
public static void addTestsFromStream(InputStream in, List<String> list)
        throws IOException {
    Properties props = new Properties();
    props.load(in);
    for (Object obj: props.keySet()) {
        list.add(obj.toString());
    }
}
 
開發者ID:middle2tw,項目名稱:whackpad,代碼行數:9,代碼來源:TestUtils.java

示例11: processProperties

import java.util.Properties; //導入方法依賴的package包/類
@Override
protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
		throws BeansException {
	super.processProperties(beanFactoryToProcess, props);
	for (Object key : props.keySet()) {
		String keyStr = key.toString();
		String value = props.getProperty(keyStr);
		propertyMap.put(keyStr, value);
	}
}
 
開發者ID:yi-jun,項目名稱:aaden-pay,代碼行數:11,代碼來源:SimpleProperty.java

示例12: insertNameForComponent

import java.util.Properties; //導入方法依賴的package包/類
public OMapComponent insertNameForComponent(String name, Properties urp, Properties properties) {
    OMapComponent omapComponent = new OMapComponent(this);
    omapComponent.setName(name);
    omapComponent.setCreated(Calendar.getInstance().getTime().getTime());
    List<OMapRecognitionProperty> omapRProps = new ArrayList<OMapRecognitionProperty>();
    for (Object rprop : urp.keySet()) {
        OMapRecognitionProperty rproperty = new OMapRecognitionProperty();
        rproperty.setName(rprop.toString());
        rproperty.setMethod(IPropertyAccessor.METHOD_EQUALS);
        rproperty.setValue(urp.getProperty(rprop.toString()));
        omapRProps.add(rproperty);
    }
    omapComponent.setComponentRecognitionProperties(omapRProps);
    List<OMapProperty> others = new ArrayList<OMapProperty>();
    for (Object otherProp : properties.keySet()) {
        String v = properties.getProperty(otherProp.toString());
        if (v != null && !"".equals(v)) {
            OMapProperty p = new OMapProperty();
            p.setName(otherProp.toString());
            p.setValue(v);
            others.add(p);
        }
    }
    omapComponent.setGeneralProperties(others);
    OMapComponent existing = nameComponentMap.get(name);
    if (existing == null) {
        components.add(omapComponent);
        nameComponentMap.put(name, omapComponent);
    } else {
        components.remove(existing);
        components.add(omapComponent);
        nameComponentMap.put(name, omapComponent);
    }
    return omapComponent;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:36,代碼來源:OMapContainer.java

示例13: logProperties

import java.util.Properties; //導入方法依賴的package包/類
public static void logProperties(Properties properties) {
    System.out
            .println("Starting WebService test with the following properties:");
    for (Object key : properties.keySet()) {
        System.out.println("\t" + key + "="
                + properties.getProperty((String) key));
    }
    System.out.println();
    System.out
            .println("If the environment specific properties are wrong, especially bes.https.url and glassfish.bes.domain");
    System.out
            .println("\tplease override them in oscm-devruntime/javares/local/<hostname>/test.properties !");
    System.out.println();
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:15,代碼來源:ServiceFactory.java

示例14: loadPropertiesInTable

import java.util.Properties; //導入方法依賴的package包/類
public static void loadPropertiesInTable(Properties x, JTable table, String exculdeKey) {
    ((DefaultTableModel) table.getModel()).setRowCount(0);
    if (x != null) {
        for (Object key : x.keySet()) {
            if (!exculdeKey.equals(key)) {
                addValueinTable(table, key, (String) x.get(key.toString()));
            }
        }
    }
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:11,代碼來源:PropUtils.java

示例15: readPotionColors

import java.util.Properties; //導入方法依賴的package包/類
private static int[] readPotionColors(Properties p_readPotionColors_0_, String p_readPotionColors_1_, String p_readPotionColors_2_, String p_readPotionColors_3_)
{
    int[] aint = new int[getMaxPotionId()];
    Arrays.fill((int[])aint, (int) - 1);
    int i = 0;

    for (Object s0 : p_readPotionColors_0_.keySet())
    {
    	String s = (String) s0;
        String s1 = p_readPotionColors_0_.getProperty(s);

        if (s.startsWith(p_readPotionColors_2_))
        {
            int j = getPotionId(s);
            int k = parseColor(s1);

            if (j >= 0 && j < aint.length && k >= 0)
            {
                aint[j] = k;
                ++i;
            }
            else
            {
                warn("Invalid color: " + s + " = " + s1);
            }
        }
    }

    if (i <= 0)
    {
        return null;
    }
    else
    {
        dbg(p_readPotionColors_3_ + " colors: " + i);
        return aint;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:39,代碼來源:CustomColors.java


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