davsclaus commented on a change in pull request #81: Support camel 3.0.0 M3 #79
URL: https://github.com/apache/camel-k-runtime/pull/81#discussion_r292030263
##########
File path:
camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java
##########
@@ -28,45 +28,30 @@
import java.util.Objects;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.function.BiConsumer;
-import java.util.function.Predicate;
import org.apache.camel.CamelContext;
import org.apache.camel.component.properties.PropertiesComponent;
import org.apache.camel.k.Constants;
-import org.apache.camel.support.IntrospectionSupport;
+import org.apache.camel.support.PropertyBindingSupport;
import org.apache.camel.util.ObjectHelper;
import org.apache.commons.io.FilenameUtils;
public final class PropertiesSupport {
private PropertiesSupport() {
}
- public static void forEachProperty(CamelContext context, Predicate<String>
nameFilter, BiConsumer<String, Object> consumer) {
- final PropertiesComponent component =
context.getComponent("properties", PropertiesComponent.class);
- final Properties properties = component.getInitialProperties();
-
- if (properties != null) {
- for (String name: properties.stringPropertyNames()) {
- if (nameFilter.test(name)) {
- consumer.accept(name, properties.get(name));
- }
- }
- }
- }
-
public static int bindProperties(CamelContext context, Object target,
String prefix) {
final PropertiesComponent component =
context.getComponent("properties", PropertiesComponent.class);
- final Properties properties = component.getInitialProperties();
+ final Properties properties = component.loadProperties();
if (properties == null) {
return 0;
}
- return bindProperties(properties, target, prefix);
+ return bindProperties(context, properties, target, prefix);
}
- public static int bindProperties(Properties properties, Object target,
String prefix) {
+ public static int bindProperties(CamelContext context, Properties
properties, Object target, String prefix) {
Review comment:
We could likely add API on PropertyBindingSupport to support prefix so we
have it OOTB, fell free to log a JIRA
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services