Skip to content

Commit

Permalink
chore: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Jun 20, 2019
1 parent e9fc7b1 commit 253358b
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
</dependencies>

<build>
<defaultGoal>exec:java</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
</dependencies>

<build>
<defaultGoal>exec:java</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
*/
package org.apache.camel.k.groovy.dsl


import org.apache.camel.support.IntrospectionSupport
import org.apache.camel.support.PropertyBindingSupport

class ComponentConfiguration {
private final org.apache.camel.Component component
Expand Down Expand Up @@ -47,13 +49,13 @@ class ComponentConfiguration {
}
}

if (!IntrospectionSupport.setProperty(component, name, value, true)) {
if (!PropertyBindingSupport.bindProperty(component.camelContext, component, name, value)) {
throw new MissingMethodException(name, this.component.class, args as Object[])
}
}

def propertyMissing(String name, value) {
if (!IntrospectionSupport.setProperty(component, name, value, true)) {
if (!PropertyBindingSupport.bindProperty(component.camelContext, component, name, value,)) {
throw new MissingMethodException(name, this.component.class, value)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public ServletEndpoint(CamelContext context, String bindHost, int bindPort, Stri
this.path = path;
}

@SuppressWarnings("unchecked")
@Override
protected void doStart() throws Exception {
DeploymentInfo servletBuilder = Servlets.deployment()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.support.DefaultComponent;
import org.apache.camel.support.IntrospectionSupport;
import org.apache.camel.support.PropertyBindingSupport;
import org.apache.camel.util.StringHelper;

public class KnativeComponent extends DefaultComponent {
Expand Down Expand Up @@ -101,7 +101,7 @@ protected Endpoint createEndpoint(String uri, String remaining, Map<String, Obje
final KnativeConfiguration conf = getKnativeConfiguration();

// set properties from the endpoint uri
IntrospectionSupport.setProperties(getCamelContext().getTypeConverter(), conf, parameters);
PropertyBindingSupport.bindProperties(getCamelContext(), conf, parameters);

return new KnativeEndpoint(uri, this, Knative.Type.valueOf(type), target, conf);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public KnativeServiceDefinition lookupServiceOrDefault(Knative.Type type, String
//
// ************************

private Optional<KnativeServiceDefinition> lookup(Knative.Type type, String name) {
@SuppressWarnings("unchecked")
private Optional<KnativeServiceDefinition> lookup(Knative.Type type, String name) {
final String contextPath = StringHelper.after(name, "/");
final String serviceName = (contextPath == null) ? name : StringHelper.before(name, "/");

Expand Down Expand Up @@ -176,6 +177,7 @@ public static KnativeEnvironment mandatoryLoadFromResource(CamelContext context,
//
// ************************

@SuppressWarnings("unchecked")
public final static class KnativeServiceDefinition extends DefaultServiceDefinition {
@JsonCreator
public KnativeServiceDefinition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static boolean hasStructuredContent(Exchange exchange) {
return Objects.equals(exchange.getIn().getHeader(Exchange.CONTENT_TYPE), Knative.MIME_STRUCTURED_CONTENT_MODE);
}

@SafeVarargs
public static <K, V> Map<K, V> mergeMaps(Map<K, V> map, Map<K, V>... maps) {
Map<K, V> answer = new HashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private V01() {
};
};

@SuppressWarnings("unchecked")
public static final Function<KnativeEndpoint, Processor> CONSUMER = (KnativeEndpoint endpoint) -> {
return exchange -> {
if (!KnativeSupport.hasStructuredContent(exchange)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private V02() {
};
};

@SuppressWarnings("unchecked")
public static final Function<KnativeEndpoint, Processor> CONSUMER = (KnativeEndpoint endpoint) -> {
return exchange -> {
if (!KnativeSupport.hasStructuredContent(exchange)) {
Expand Down

0 comments on commit 253358b

Please sign in to comment.