private static MultiValueMap<String, Entry> parseIndex(List<Properties> content) { MultiValueMap<String, Entry> index = new LinkedMultiValueMap<>(); for (Properties entry : content) { entry.forEach((type, values) -> { String[] stereotypes = ((String) values).split(","); for (String stereotype : stereotypes) { index.add(stereotype, new Entry((String) type)); } }); } return index; }
/** * Set multiple {@link KafkaConsumer} properties. */ public T setProp(Properties props) { props.forEach((key, value) -> { if (key instanceof String) { kafkaProps.put((String) key, value); } else { throw new IllegalArgumentException("Kafka Consumer property keys must be Strings"); } }); return (T)this; }
public Map<String, String> toMap() { var map = new HashMap<String, String>(props.size()); props.forEach((k, v) -> map.put(k.toString(), v.toString())); return map; }
public Map<String, String> toMap() { var map = new HashMap<String, String>(props.size()); props.forEach((k, v) -> map.put(k.toString(), v.toString())); return map; }
public Environment addAll(@NonNull Properties props) { props.forEach((key, value) -> this.props.setProperty(key.toString(), value.toString())); return this; }
public Environment addAll(@NonNull Properties props) { props.forEach((key, value) -> this.props.setProperty(key.toString(), value.toString())); return this; }
public Map<String, Object> getPrefix(String key) { var map = new HashMap<String, Object>(); if (null != key) { props.forEach((key_, value) -> { if (key_.toString().startsWith(key)) { map.put(key_.toString().substring(key.length() + 1), value); } }); } return map; }
public static CandidateComponentsMetadata read(InputStream in) throws IOException { CandidateComponentsMetadata result = new CandidateComponentsMetadata(); Properties props = new Properties(); props.load(in); props.forEach((type, value) -> { Set<String> candidates = new HashSet<>(Arrays.asList(((String) value).split(","))); result.add(new ItemMetadata((String) type, candidates)); }); return result; }
public Map<String, Object> getPrefix(String key) { var map = new HashMap<String, Object>(); if (null != key) { props.forEach((key_, value) -> { if (key_.toString().startsWith(key)) { map.put(key_.toString().substring(key.length() + 1), value); } }); } return map; }
/** * Add a mapping from a key, extracted from a path extension or a query * parameter, to a MediaType. This is required in order for the parameter * strategy to work. Any extensions explicitly registered here are also * whitelisted for the purpose of Reflected File Download attack detection * (see Spring Framework reference documentation for more details on RFD * attack protection). * <p>The path extension strategy will also try to use * {@link ServletContext#getMimeType} and * {@link org.springframework.http.MediaTypeFactory} to resolve path extensions. * @param mediaTypes media type mappings * @see #addMediaType(String, MediaType) * @see #addMediaTypes(Map) */ public void setMediaTypes(Properties mediaTypes) { if (!CollectionUtils.isEmpty(mediaTypes)) { mediaTypes.forEach((key, value) -> { String extension = ((String) key).toLowerCase(Locale.ENGLISH); MediaType mediaType = MediaType.valueOf((String) value); this.mediaTypes.put(extension, mediaType); }); } }
@Override public synchronized void loadFromXML( InputStream in ) throws IOException, InvalidPropertiesFormatException { super.putAll( storageMap ); super.loadFromXML( in ); super.forEach( ( key, value ) -> storageMap.putIfAbsent( key, value ) ); super.clear(); }
@Override public synchronized void load( Reader reader ) throws IOException { super.putAll( storageMap ); super.load( reader ); super.forEach( ( key, value ) -> storageMap.put( key, value ) ); super.clear(); }
private Properties replacePrefix(Properties props) { Properties newProps = new Properties(); props.forEach((key,value) -> newProps.put(key.toString().replaceFirst(HIKARI + ".", ""), value)); return newProps; }
@Override public synchronized void load( InputStream inStream ) throws IOException { super.putAll( storageMap ); super.load( inStream ); super.forEach( ( key, value ) -> storageMap.put( key, value ) ); super.clear(); }
private static MultiValueMap<String, Entry> parseIndex(List<Properties> content) { MultiValueMap<String, Entry> index = new LinkedMultiValueMap<>(); for (Properties entry : content) { entry.forEach((type, values) -> { String[] stereotypes = ((String) values).split(","); for (String stereotype : stereotypes) { index.add(stereotype, new Entry((String) type)); } }); } return index; }
/** * Sets the configuration properties for the Kafka consumer. Resets previously set properties. * * @param properties The configuration properties for the Kafka consumer. */ public Kafka properties(Properties properties) { Preconditions.checkNotNull(properties); if (this.kafkaProperties == null) { this.kafkaProperties = new HashMap<>(); } this.kafkaProperties.clear(); properties.forEach((k, v) -> this.kafkaProperties.put((String) k, (String) v)); return this; }
public Props(Properties props) { this.properties = new Properties(); props.forEach((k, v) -> this.properties.put(k.toString().trim(), v == null ? null : v.toString().trim())); this.encryption = new Encryption(props.getProperty(AesCipher.ENCRYPTION_SECRET_KEY_PATH)); }
@Override public Map<String, String> getProperties() { Map<String, String> result = new HashMap<>(); loadAll(result); systemProps.forEach((key, value) -> result.put((String) key, (String) value)); return unmodifiableMap(result); }
@VisibleForTesting ThreadLocalSettings(PropertyDefinitions definitions, Properties props, SettingLoader settingLoader) { super(definitions, new Encryption(null)); this.settingLoader = settingLoader; props.forEach((k, v) -> systemProps.put(k, v == null ? null : v.toString().trim())); // TODO something wrong about lifecycle here. It could be improved getEncryption().setPathToSecretKey(props.getProperty(CoreProperties.ENCRYPTION_SECRET_KEY_PATH)); }