本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例5: setVariables
import java.util.Properties; //导入方法依赖的package包/类
@Override
public void setVariables(Properties variables) {
variables.forEach((name, value) -> config.setProperty((String) name, value));
}
示例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;
}
}
示例7: SmeshProperties
import java.util.Properties; //导入方法依赖的package包/类
public SmeshProperties(Properties nullableProperties) {
if (nullableProperties != null) {
nullableProperties.forEach((key, value) -> properties.put((String)key, (String) value));
}
}
示例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));
}