public String build ( ) { StringBuilder sb = new StringBuilder ( funcName + "(" ) ; // Join args and kwargs into simple strings. String args = argList . stream ( ) . map ( PyExpr :: getText ) . filter ( Objects :: nonNull ) . collect ( Collectors . joining ( ", " ) ) ; String kwargs = kwargMap . entrySet ( ) . stream ( ) . map ( entry -> entry . getKey ( ) + "=" + entry . getValue ( ) . getText ( ) ) . filter ( Objects :: nonNull ) . collect ( Collectors . joining ( ", " ) ) ; // Strip empty strings. args = Strings . emptyToNull ( args ) ; kwargs = Strings . emptyToNull ( kwargs ) ; // Join all pieces together. Joiner . on ( ", " ) . skipNulls ( ) . appendTo ( sb , args , kwargs , unpackedKwargs ) ; sb . append ( ")" ) ; return sb . toString ( ) ; }
Returns a valid Python function call as a String .