You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2020/04/17 08:51:39 UTC
[camel] branch master updated: CAMEL-14924: Introduce
nativeSupported on BaseModel
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 272c112 CAMEL-14924: Introduce nativeSupported on BaseModel
272c112 is described below
commit 272c11246976f96601895605c0a1df6b5a28d0e8
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Fri Apr 17 09:18:35 2020 +0200
CAMEL-14924: Introduce nativeSupported on BaseModel
---
.../java/org/apache/camel/tooling/model/BaseModel.java | 16 ++++++++++++++++
.../java/org/apache/camel/tooling/model/JsonMapper.java | 16 ++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/BaseModel.java b/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/BaseModel.java
index a3a1b64..4027210 100644
--- a/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/BaseModel.java
+++ b/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/BaseModel.java
@@ -32,6 +32,7 @@ public abstract class BaseModel<O extends BaseOptionModel> {
protected String deprecationNote;
protected final List<O> options = new ArrayList<>();
protected SupportLevel supportLevel;
+ protected boolean nativeSupported;
public static Comparator<BaseModel<?>> compareTitle() {
return (m1, m2) -> m1.getTitle().compareToIgnoreCase(m2.getTitle());
@@ -127,4 +128,19 @@ public abstract class BaseModel<O extends BaseOptionModel> {
this.supportLevel = supportLevel;
}
+ /**
+ * @return {@code true} if the part represented by this model supports compilation to native code; {@code false}
+ * otherwise
+ */
+ public boolean isNativeSupported() {
+ return nativeSupported;
+ }
+
+ /**
+ * @param nativeSupported see {@link #isNativeSupported()}
+ */
+ public void setNativeSupported(boolean nativeSupported) {
+ this.nativeSupported = nativeSupported;
+ }
+
}
diff --git a/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/JsonMapper.java b/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/JsonMapper.java
index 2375ff4..3fc2dea 100644
--- a/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/JsonMapper.java
+++ b/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/JsonMapper.java
@@ -146,6 +146,9 @@ public final class JsonMapper {
if (model.getSupportLevel() != null) {
obj.put("supportLevel", model.getSupportLevel().name());
}
+ if (model.isNativeSupported()) {
+ obj.put("nativeSupported", model.isNativeSupported());
+ }
obj.put("groupId", model.getGroupId());
obj.put("artifactId", model.getArtifactId());
obj.put("version", model.getVersion());
@@ -202,6 +205,9 @@ public final class JsonMapper {
if (model.getSupportLevel() != null) {
obj.put("supportLevel", model.getSupportLevel().name());
}
+ if (model.isNativeSupported()) {
+ obj.put("nativeSupported", model.isNativeSupported());
+ }
obj.put("groupId", model.getGroupId());
obj.put("artifactId", model.getArtifactId());
obj.put("version", model.getVersion());
@@ -254,6 +260,9 @@ public final class JsonMapper {
if (model.getSupportLevel() != null) {
obj.put("supportLevel", model.getSupportLevel().name());
}
+ if (model.isNativeSupported()) {
+ obj.put("nativeSupported", model.isNativeSupported());
+ }
obj.entrySet().removeIf(e -> e.getValue() == null);
JsonObject wrapper = new JsonObject();
wrapper.put("model", obj);
@@ -306,6 +315,9 @@ public final class JsonMapper {
if (model.getSupportLevel() != null) {
obj.put("supportLevel", model.getSupportLevel().name());
}
+ if (model.isNativeSupported()) {
+ obj.put("nativeSupported", model.isNativeSupported());
+ }
obj.put("groupId", model.getGroupId());
obj.put("artifactId", model.getArtifactId());
obj.put("version", model.getVersion());
@@ -349,6 +361,9 @@ public final class JsonMapper {
if (model.getSupportLevel() != null) {
obj.put("supportLevel", model.getSupportLevel().name());
}
+ if (model.isNativeSupported()) {
+ obj.put("nativeSupported", model.isNativeSupported());
+ }
obj.put("groupId", model.getGroupId());
obj.put("artifactId", model.getArtifactId());
obj.put("version", model.getVersion());
@@ -368,6 +383,7 @@ public final class JsonMapper {
model.setDeprecationNote(mobj.getString("label"));
model.setJavaType(mobj.getString("javaType"));
model.setSupportLevel(SupportLevel.safeValueOf(mobj.getString("supportLevel")));
+ model.setNativeSupported(mobj.getBooleanOrDefault("nativeSupported", false));
}
private static void parseOption(JsonObject mp, BaseOptionModel option, String name) {