本文整理匯總了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));
}