当前位置: 首页>>代码示例>>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;未经允许,请勿转载。