You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2013/08/28 16:18:42 UTC

svn commit: r876486 - in /websites/production/camel/content: cache/main.pageCache type-converter.html

Author: buildbot
Date: Wed Aug 28 14:18:41 2013
New Revision: 876486

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/type-converter.html

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/type-converter.html
==============================================================================
--- websites/production/camel/content/type-converter.html (original)
+++ websites/production/camel/content/type-converter.html Wed Aug 28 14:18:41 2013
@@ -203,6 +203,23 @@ public class IOConverter {
 
 <p>We have most of the common converters for common Java types in the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/converter/package-summary.html">org.apache.camel.converter</a> package and its children.</p>
 
+<h4><a shape="rect" name="TypeConverter-Returningnullvalues"></a>Returning null values</h4>
+
+<p>By default when using a method in a POJO annotation with @Converter returning null is not a valid response. If null is returned, then Camel will regard that type converter as a <em>miss</em>, and prevent from using it in the future. If null should be allowed as a valid response, then from <b>Camel 2.11.2/2.12.1</b> onwards you can specify this in the annotation as shown:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+    @Converter(allowNull = true)
+    public static InputStream toInputStream(File file) throws IOException {
+        if (file.exist()) {
+            return new BufferedInputStream(new FileInputStream(file));
+        } else {
+            return null;
+        }
+    }
+]]></script>
+</div></div>
+
 <h3><a shape="rect" name="TypeConverter-DiscoveringFallbackTypeConverters"></a>Discovering Fallback Type Converters</h3>
 <p><b>Available in Camel 2.0</b><br clear="none">
 The <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/converter/AnnotationTypeConverterLoader.html">AnnotationTypeConverterLoader</a> has been enhanced to also look for methods defined with a @FallbackConverter annotation, and register it as a fallback type converter.</p>