@@ -133,6 +133,10 @@ public FunctionRegistration<?> getRegistration(Object function) {
133
133
134
134
@ Override
135
135
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
+ }
136
140
this .functionRegistrations .add (registration );
137
141
}
138
142
@@ -169,7 +173,7 @@ <T> T doLookup(Class<?> type, String functionDefinition, String[] expectedOutput
169
173
if (function != null ) {
170
174
function .expectedOutputContentType = expectedOutputMimeTypes ;
171
175
}
172
- else {
176
+ else if ( logger . isDebugEnabled ()) {
173
177
logger .debug ("Function '" + functionDefinition + "' is not found in cache" );
174
178
}
175
179
@@ -260,6 +264,9 @@ private FunctionInvocationWrapper compose(Class<?> type, String functionDefiniti
260
264
this .wrappedFunctionDefinitions .put (composedFunction .functionDefinition , composedFunction );
261
265
}
262
266
}
267
+ if (logger .isDebugEnabled ()) {
268
+ logger .debug ("Composed function " + composedFunction );
269
+ }
263
270
return composedFunction ;
264
271
}
265
272
@@ -329,10 +336,16 @@ public class FunctionInvocationWrapper implements Function<Object, Object>, Cons
329
336
}
330
337
331
338
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
+ }
332
342
this .skipInputConversion = skipInputConversion ;
333
343
}
334
344
335
345
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
+ }
336
349
this .skipOutputConversion = skipOutputConversion ;
337
350
}
338
351
@@ -398,7 +411,9 @@ public Class<?> getRawInputType() {
398
411
*/
399
412
@ Override
400
413
public Object apply (Object input ) {
401
-
414
+ if (logger .isDebugEnabled () && !(input instanceof Publisher )) {
415
+ logger .debug ("Invoking function " + this );
416
+ }
402
417
Object result = this .doApply (input );
403
418
404
419
if (result != null && this .outputType != null ) {
@@ -795,9 +810,15 @@ else if (input instanceof Message) {
795
810
? new OriginalMessageHolder (convertedInput , (Message <?>) input )
796
811
: convertedInput ;
797
812
}
813
+ if (convertedInput != null && logger .isDebugEnabled ()) {
814
+ logger .debug ("Converted Message: " + input + " to: " + convertedInput );
815
+ }
798
816
}
799
817
else {
800
818
convertedInput = this .convertNonMessageInputIfNecessary (type , input );
819
+ if (convertedInput != null && logger .isDebugEnabled ()) {
820
+ logger .debug ("Converted input: " + input + " to: " + convertedInput );
821
+ }
801
822
}
802
823
// wrap in Message if necessary
803
824
if (this .isWrapConvertedInputInMessage (convertedInput )) {
@@ -828,7 +849,6 @@ private Object convertOutputIfNecessary(Object output, Type type, String[] conte
828
849
return output ;
829
850
}
830
851
831
-
832
852
Object convertedOutput = output ;
833
853
if (FunctionTypeUtils .isMultipleArgumentType (type )) {
834
854
convertedOutput = this .convertMultipleOutputArgumentTypeIfNecesary (convertedOutput , type , contentType );
@@ -944,7 +964,6 @@ private Object convertInputMessageIfNecessary(Message message, Type type) {
944
964
return message .getPayload ();
945
965
}
946
966
}
947
- //if (message.getPayload().getClass().isAss) {
948
967
949
968
Object convertedInput = message ;
950
969
type = this .extractActualValueTypeIfNecessary (type );
0 commit comments