public static String getSerializedVectorClocks ( List < VectorClock > vectorClocks ) { List < VectorClockWrapper > vectorClockWrappers = new ArrayList < VectorClockWrapper > ( ) ; for ( VectorClock vc : vectorClocks ) { vectorClockWrappers . add ( new VectorClockWrapper ( vc ) ) ; } String serializedVC = "" ; try { serializedVC = mapper . writeValueAsString ( vectorClockWrappers ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return serializedVC ; }
Function to serialize the given list of Vector clocks into a string . If something goes wrong it returns an empty string .