This is an automated email from the ASF dual-hosted git repository. lburgazzoli 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 9c87948 core: add a DataFormatDefinitionAware interface to mark processors that support data formats 9c87948 is described below commit 9c879480fe85d727a617fc4370e028390ffda68c Author: Luca Burgazzoli <lburgazz...@gmail.com> AuthorDate: Fri Dec 18 16:11:51 2020 +0100 core: add a DataFormatDefinitionAware interface to mark processors that support data formats --- .../camel/model/DataFormatDefinitionAware.java | 32 ++++++++++++++++++++++ .../org/apache/camel/model/MarshalDefinition.java | 4 ++- .../apache/camel/model/UnmarshalDefinition.java | 4 ++- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/DataFormatDefinitionAware.java b/core/camel-core-model/src/main/java/org/apache/camel/model/DataFormatDefinitionAware.java new file mode 100644 index 0000000..abf9ad7 --- /dev/null +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/DataFormatDefinitionAware.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.model; + +/** + * Marker interface to mark a {@link ProcessorDefinition} that supports data formats. + */ +public interface DataFormatDefinitionAware { + /** + * The data format. + */ + DataFormatDefinition getDataFormatType(); + + /** + * The data format to be used. + */ + void setDataFormatType(DataFormatDefinition dataFormatType); +} diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/MarshalDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/MarshalDefinition.java index cdfb802..ab807a4 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/MarshalDefinition.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/MarshalDefinition.java @@ -71,7 +71,7 @@ import org.apache.camel.spi.Metadata; @Metadata(label = "dataformat,transformation") @XmlRootElement(name = "marshal") @XmlAccessorType(XmlAccessType.FIELD) -public class MarshalDefinition extends NoOutputDefinition<MarshalDefinition> { +public class MarshalDefinition extends NoOutputDefinition<MarshalDefinition> implements DataFormatDefinitionAware { @XmlElements({ @XmlElement(required = false, name = "any23", type = Any23DataFormat.class), @@ -143,6 +143,7 @@ public class MarshalDefinition extends NoOutputDefinition<MarshalDefinition> { return "marshal[" + description() + "]"; } + @Override public DataFormatDefinition getDataFormatType() { return dataFormatType; } @@ -150,6 +151,7 @@ public class MarshalDefinition extends NoOutputDefinition<MarshalDefinition> { /** * The data format to be used */ + @Override public void setDataFormatType(DataFormatDefinition dataFormatType) { this.dataFormatType = dataFormatType; } diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/UnmarshalDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/UnmarshalDefinition.java index 4cceb99..4318aa1 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/UnmarshalDefinition.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/UnmarshalDefinition.java @@ -71,7 +71,7 @@ import org.apache.camel.spi.Metadata; @Metadata(label = "dataformat,transformation") @XmlRootElement(name = "unmarshal") @XmlAccessorType(XmlAccessType.FIELD) -public class UnmarshalDefinition extends NoOutputDefinition<UnmarshalDefinition> { +public class UnmarshalDefinition extends NoOutputDefinition<UnmarshalDefinition> implements DataFormatDefinitionAware { @XmlElements({ @XmlElement(required = false, name = "any23", type = Any23DataFormat.class), @@ -147,6 +147,7 @@ public class UnmarshalDefinition extends NoOutputDefinition<UnmarshalDefinition> return "unmarshal[" + description() + "]"; } + @Override public DataFormatDefinition getDataFormatType() { return dataFormatType; } @@ -154,6 +155,7 @@ public class UnmarshalDefinition extends NoOutputDefinition<UnmarshalDefinition> /** * The data format to be used */ + @Override public void setDataFormatType(DataFormatDefinition dataFormatType) { this.dataFormatType = dataFormatType; }