@ Validate public void start ( ) { module = new SimpleModule ( MonitorExtension . class . getName ( ) ) ; module . addSerializer ( MonitorExtension . class , new JsonSerializer < MonitorExtension > ( ) { @ Override public void serialize ( MonitorExtension monitorExtension , JsonGenerator jsonGenerator , SerializerProvider serializerProvider ) throws IOException { jsonGenerator . writeStartObject ( ) ; jsonGenerator . writeStringField ( "label" , monitorExtension . label ( ) ) ; jsonGenerator . writeStringField ( "url" , monitorExtension . url ( ) ) ; jsonGenerator . writeStringField ( "category" , monitorExtension . category ( ) ) ; jsonGenerator . writeEndObject ( ) ; } } ) ; repository . register ( module ) ; }
When the monitor starts we initializes and registers a JSON module handling the serialization of the monitor extension .