Polished

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a999d47e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a999d47e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a999d47e

Branch: refs/heads/master
Commit: a999d47e95733a4ff6dc31e857cb1e0ac5564276
Parents: bbaa6ea
Author: Claus Ibsen <davscl...@apache.org>
Authored: Fri May 26 19:01:11 2017 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Sat May 27 09:03:47 2017 +0200

----------------------------------------------------------------------
 .../apache/camel/processor/ContractAdvice.java   | 19 ++++++++++++-------
 .../main/java/org/apache/camel/spi/DataType.java |  5 ++++-
 2 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a999d47e/camel-core/src/main/java/org/apache/camel/processor/ContractAdvice.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/processor/ContractAdvice.java 
b/camel-core/src/main/java/org/apache/camel/processor/ContractAdvice.java
index 361b47a..5ff0ff2 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/ContractAdvice.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/ContractAdvice.java
@@ -20,6 +20,8 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.ValidationException;
+import org.apache.camel.model.InputTypeDefinition;
+import org.apache.camel.model.OutputTypeDefinition;
 import org.apache.camel.spi.Contract;
 import org.apache.camel.spi.DataType;
 import org.apache.camel.spi.DataTypeAware;
@@ -31,16 +33,19 @@ import org.slf4j.LoggerFactory;
 /**
  * A {@link CamelInternalProcessorAdvice} which applies {@link Transformer} 
and {@link Validator}
  * according to the data type Contract.
+ * <p/>
  * The default camel {@link Message} implements {@link DataTypeAware} which
  * holds a {@link DataType} to indicate current message type. If the input type
- * declared by {@link InputTypeDefinition} is diffrent from current IN message 
type,
+ * declared by {@link InputTypeDefinition} is different from current IN 
message type,
  * camel internal processor look for a Transformer which transforms from the 
current
  * message type to the expected message type before routing.
  * After routing, if the output type declared by {@link OutputTypeDefinition} 
is different
  * from current OUT message (or IN message if no OUT), camel look for a 
Transformer and apply.
  * 
- * @see {@link Transformer} {@link Validator}
- * {@link InputTypeDefinition} {@link OutputTypeDefinition}
+ * @see Transformer
+ * @see Validator}
+ * @see InputTypeDefinition
+ * @see OutputTypeDefinition
  */
 public class ContractAdvice implements CamelInternalProcessorAdvice {
     private static final Logger LOG = 
LoggerFactory.getLogger(CamelInternalProcessor.class);
@@ -56,10 +61,10 @@ public class ContractAdvice implements 
CamelInternalProcessorAdvice {
         if (!(exchange.getIn() instanceof DataTypeAware)) {
             return null;
         }
-        DataTypeAware target = (DataTypeAware)exchange.getIn();
-        DataType from = target.getDataType();
         DataType to = contract.getInputType();
         if (to != null) {
+            DataTypeAware target = (DataTypeAware)exchange.getIn();
+            DataType from = target.getDataType();
             if (!to.equals(from)) {
                 LOG.debug("Looking for transformer for INPUT: from='{}', 
to='{}'", from, to);
                 doTransform(exchange.getIn(), from, to);
@@ -83,10 +88,10 @@ public class ContractAdvice implements 
CamelInternalProcessorAdvice {
         if (!(target instanceof DataTypeAware)) {
             return;
         }
-        DataTypeAware typeAwareTarget = (DataTypeAware)target;
-        DataType from = typeAwareTarget.getDataType();
         DataType to = contract.getOutputType();
         if (to != null) {
+            DataTypeAware typeAwareTarget = (DataTypeAware)target;
+            DataType from = typeAwareTarget.getDataType();
             if (!to.equals(from)) {
                 LOG.debug("Looking for transformer for OUTPUT: from='{}', 
to='{}'", from, to);
                 doTransform(target, from, to);

http://git-wip-us.apache.org/repos/asf/camel/blob/a999d47e/camel-core/src/main/java/org/apache/camel/spi/DataType.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/spi/DataType.java 
b/camel-core/src/main/java/org/apache/camel/spi/DataType.java
index 7c07188..7ba8f6c 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/DataType.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/DataType.java
@@ -20,6 +20,7 @@ import org.apache.camel.util.StringHelper;
 
 /**
  * Represents the data type URN which is used for message data type contract.
+ * <p/>
  * Java class doesn't always explain the data type completely, for example XML 
and JSON
  * data format is sometimes serialized as a {@code String}, {@code 
InputStream} or etc.
  * The {@link DataTypeAware} message stores the DataType as a part of the 
message to carry
@@ -30,7 +31,9 @@ import org.apache.camel.util.StringHelper;
  * or 'json:XYZOrder'. These type name other than java class name allows the 
message to
  * carry the name of the message data structure even if it's marshaled.
  * 
- * @see {@link DataTypeAware} {@link Transformer} {@link Validator}
+ * @see DataTypeAware
+ * @see Transformer
+ * @see Validator
  */
 public class DataType {
 

Reply via email to