public static TopologyAPI . Config . Builder getConfigBuilder ( Config config ) { TopologyAPI . Config . Builder cBldr = TopologyAPI . Config . newBuilder ( ) ; Set < String > apiVars = config . getApiVars ( ) ; for ( String key : config . keySet ( ) ) { if ( key == null ) { LOG . warning ( "ignore: null config key found" ) ; continue ; } Object value = config . get ( key ) ; if ( value == null ) { LOG . warning ( "ignore: config key " + key + " has null value" ) ; continue ; } TopologyAPI . Config . KeyValue . Builder b = TopologyAPI . Config . KeyValue . newBuilder ( ) ; b . setKey ( key ) ; if ( apiVars . contains ( key ) ) { b . setType ( TopologyAPI . ConfigValueType . STRING_VALUE ) ; b . setValue ( value . toString ( ) ) ; } else { b . setType ( TopologyAPI . ConfigValueType . JAVA_SERIALIZED_VALUE ) ; b . setSerializedValue ( ByteString . copyFrom ( serialize ( value ) ) ) ; } cBldr . addKvs ( b ) ; } return cBldr ; }
Converts a Heron Config object into a TopologyAPI . Config . Builder . Config entries with null keys or values are ignored .