@@ -133,6 +133,10 @@ public FunctionRegistration<?> getRegistration(Object function) {
133133
134134 @ Override
135135 public <T > void register (FunctionRegistration <T > registration ) {
136+ Assert .notNull (registration , "'registration' must not be null" );
137+ if (logger .isDebugEnabled ()) {
138+ logger .debug ("Registering function " + registration .getNames ());
139+ }
136140 this .functionRegistrations .add (registration );
137141 }
138142
@@ -169,7 +173,7 @@ <T> T doLookup(Class<?> type, String functionDefinition, String[] expectedOutput
169173 if (function != null ) {
170174 function .expectedOutputContentType = expectedOutputMimeTypes ;
171175 }
172- else {
176+ else if ( logger . isDebugEnabled ()) {
173177 logger .debug ("Function '" + functionDefinition + "' is not found in cache" );
174178 }
175179
@@ -260,6 +264,9 @@ private FunctionInvocationWrapper compose(Class<?> type, String functionDefiniti
260264 this .wrappedFunctionDefinitions .put (composedFunction .functionDefinition , composedFunction );
261265 }
262266 }
267+ if (logger .isDebugEnabled ()) {
268+ logger .debug ("Composed function " + composedFunction );
269+ }
263270 return composedFunction ;
264271 }
265272
@@ -329,10 +336,16 @@ public class FunctionInvocationWrapper implements Function<Object, Object>, Cons
329336 }
330337
331338 public void setSkipInputConversion (boolean skipInputConversion ) {
339+ if (logger .isDebugEnabled () && skipInputConversion ) {
340+ logger .debug ("'skipInputConversion' was explicitely set to true. No input conversion will be attempted" );
341+ }
332342 this .skipInputConversion = skipInputConversion ;
333343 }
334344
335345 public void setSkipOutputConversion (boolean skipOutputConversion ) {
346+ if (logger .isDebugEnabled () && skipOutputConversion ) {
347+ logger .debug ("'skipOutputConversion' was explicitely set to true. No output conversion will be attempted" );
348+ }
336349 this .skipOutputConversion = skipOutputConversion ;
337350 }
338351
@@ -398,7 +411,9 @@ public Class<?> getRawInputType() {
398411 */
399412 @ Override
400413 public Object apply (Object input ) {
401-
414+ if (logger .isDebugEnabled () && !(input instanceof Publisher )) {
415+ logger .debug ("Invoking function " + this );
416+ }
402417 Object result = this .doApply (input );
403418
404419 if (result != null && this .outputType != null ) {
@@ -795,9 +810,15 @@ else if (input instanceof Message) {
795810 ? new OriginalMessageHolder (convertedInput , (Message <?>) input )
796811 : convertedInput ;
797812 }
813+ if (convertedInput != null && logger .isDebugEnabled ()) {
814+ logger .debug ("Converted Message: " + input + " to: " + convertedInput );
815+ }
798816 }
799817 else {
800818 convertedInput = this .convertNonMessageInputIfNecessary (type , input );
819+ if (convertedInput != null && logger .isDebugEnabled ()) {
820+ logger .debug ("Converted input: " + input + " to: " + convertedInput );
821+ }
801822 }
802823 // wrap in Message if necessary
803824 if (this .isWrapConvertedInputInMessage (convertedInput )) {
@@ -828,7 +849,6 @@ private Object convertOutputIfNecessary(Object output, Type type, String[] conte
828849 return output ;
829850 }
830851
831-
832852 Object convertedOutput = output ;
833853 if (FunctionTypeUtils .isMultipleArgumentType (type )) {
834854 convertedOutput = this .convertMultipleOutputArgumentTypeIfNecesary (convertedOutput , type , contentType );
@@ -944,7 +964,6 @@ private Object convertInputMessageIfNecessary(Message message, Type type) {
944964 return message .getPayload ();
945965 }
946966 }
947- //if (message.getPayload().getClass().isAss) {
948967
949968 Object convertedInput = message ;
950969 type = this .extractActualValueTypeIfNecessary (type );
0 commit comments