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


Java Properties.forEach方法代码示例

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


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

示例1: build

import java.util.Properties; //导入方法依赖的package包/类
public EntityManagerFactory build() {

		Properties properties = createProperties();

		DefaultPersistenceUnitInfoImpl persistenceUnitInfo = new DefaultPersistenceUnitInfoImpl(JSPARE_GATEWAY_DATASOURCE);
		persistenceUnitInfo.setProperties(properties);

		// Using RESOURCE_LOCAL for manage transactions on DAO side.
		persistenceUnitInfo.setTransactionType(PersistenceUnitTransactionType.RESOURCE_LOCAL);

		// Add all entities to configuration
		ClassAnnotationMatchProcessor processor = (c) -> persistenceUnitInfo.addAnnotatedClassName(c);
		ClasspathScannerUtils.scanner(ALL_SCAN_QUOTE).matchClassesWithAnnotation(Entity.class, processor)
				.scan(NUMBER_CLASSPATH_SCANNER_THREADS);

		Map<String, Object> configuration = new HashMap<>();
		properties.forEach((k, v) -> configuration.put((String) k, v));

		EntityManagerFactory entityManagerFactory = persistenceProvider.createContainerEntityManagerFactory(persistenceUnitInfo,
				configuration);
		return entityManagerFactory;
	}
 
开发者ID:pflima92,项目名称:jspare-vertx-ms-blueprint,代码行数:23,代码来源:JDBCProvider.java

示例2: getFoldersList

import java.util.Properties; //导入方法依赖的package包/类
private Properties getFoldersList() throws FileNotFoundException, IOException{
    Properties p = new Properties();
            
        if(Files.exists(new File(PATH).toPath())){
            FileInputStream in = new FileInputStream(new File(PATH));
            p.loadFromXML(in);
            BiConsumer<Object,Object> bi = (x,y) ->{
                p.getProperty(x.toString(), new File(y.toString()).getName());
            };
            p.forEach(bi);

        }
        return p;
}
 
开发者ID:Obsidiam,项目名称:joanne,代码行数:15,代码来源:XMLManager.java

示例3: decrypt

import java.util.Properties; //导入方法依赖的package包/类
private static Properties decrypt(Properties prop) {
    Properties dprop = new Properties();
    dprop.putAll(prop);
    dprop.forEach((key, val) -> {
        if (val.toString().matches((".* Enc"))) {
            dprop.put(key, new String(Base64.decodeBase64(val.toString().replace(" Enc", ""))));
        }
    });
    return dprop;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:11,代码来源:RemoteProxy.java

示例4: parseOptions

import java.util.Properties; //导入方法依赖的package包/类
private List<String> parseOptions() {
    if (!Files.exists(optionsPath)) {
        return Collections.emptyList();
    }
    Properties properties = new Properties();
    try (InputStream inputStream = Files.newInputStream(optionsPath)) {
        properties.load(inputStream);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

    List<String> options = new ArrayList<>();
    properties.forEach((key, value) -> options.add("-A" + key + "=" + value));
    return options;
}
 
开发者ID:Cosium,项目名称:openapi-annotation-processor,代码行数:16,代码来源:ParserCaseTester.java

示例5: setVariables

import java.util.Properties; //导入方法依赖的package包/类
@Override
public void setVariables(Properties variables) {
    variables.forEach((name, value) -> config.setProperty((String) name, value));
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:5,代码来源:CommonsConfiguration.java

示例6: configure

import java.util.Properties; //导入方法依赖的package包/类
@Override
public void configure(Map<String, String> config) {
    String operation = config.get(NAME);
    if (operation == null) {
        return;
    }

    switch (operation) {
        case "add": {
            // leave it to open-ended! source, java_version, java_full_version
            // can be passed via this option like:
            //
            //     --release-info add:build_type=fastdebug,source=openjdk,java_version=9
            // and put whatever value that was passed in command line.

            config.keySet().stream()
                  .filter(s -> !NAME.equals(s))
                  .forEach(s -> release.put(s, config.get(s)));
        }
        break;

        case "del": {
            // --release-info del:keys=openjdk,java_version
            Utils.parseList(config.get(KEYS)).stream().forEach((k) -> {
                release.remove(k);
            });
        }
        break;

        default: {
            // --release-info <file>
            Properties props = new Properties();
            try (FileInputStream fis = new FileInputStream(operation)) {
                props.load(fis);
            } catch (IOException exp) {
                throw new UncheckedIOException(exp);
            }
            props.forEach((k, v) -> release.put(k.toString(), v.toString()));
        }
        break;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:43,代码来源:ReleaseInfoPlugin.java

示例7: SmeshProperties

import java.util.Properties; //导入方法依赖的package包/类
public SmeshProperties(Properties nullableProperties) {
    if (nullableProperties != null) {
        nullableProperties.forEach((key, value) -> properties.put((String)key, (String) value));
    }
}
 
开发者ID:r2dg,项目名称:smesh,代码行数:6,代码来源:SmeshProperties.java

示例8: main

import java.util.Properties; //导入方法依赖的package包/类
public static void main(String[] args) {

    Map<String, String> env_map = System.getenv();

    out.println("Env Variables");
    env_map.forEach((key, val) -> out.println("[" + key + "] " + val));

    Properties ps = System.getProperties();

    out.println("\n\nProperties");
    ps.forEach((key, val) -> out.println("[" + key + "] " + val));

  }
 
开发者ID:Samsung,项目名称:MeziLang,代码行数:14,代码来源:SystemEnvTest.java


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