@ SuppressWarnings ( "unchecked" ) public Object marshal ( Object o ) throws RpcException { if ( o == null ) { return returnNullIfOptional ( ) ; } else if ( o instanceof BStruct ) { return validateMap ( structToMap ( o , this . s ) , this . s ) ; } else if ( o instanceof Map ) { return validateMap ( ( Map ) o , this . s ) ; } else { String msg = "Unable to convert class: " + o . getClass ( ) . getName ( ) ; throw RpcException . Error . INVALID_RESP . exc ( msg ) ; } }
Marshals native Java type o to a Map that can be serialized . Recursively marshals all of the Struct fields from o onto the map .