當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。