I am trying to solve the following violation reported by the sonarQube plugin for Jenkins: "make" update "transient or serializable". Gravity: critical, tag: serialization.
I have the following general interface
public interface MPUpdate {
void apply( SoapService svc, byte[] jerseyClientResp ) throws MPException ;
}
The following listing is an entry point for application logic.
public enum DomainResource implements MPUpdate {
PROGRAMMES( new ProgrammeUpdate() ),
PRODUCTIONS( new ProductionUpdate() );
private DomainResource( MPUpdate update ) {
this.update = update;
}
private final MPUpdate update;
@Override
public void apply( SoapService svc, byte[] jerseyClientResp ) throws MPException {
update.apply( svc, jerseyClientResp );
}
}
One of the logic blocks initialized through enum
public class ProgrammeUpdate implements MPUpdate {
private final ResponseConverter<ProgrammeDto> responseConverter = new ResponseConverter<>( ProgrammeDto.class );
@Override
public void apply( SoapService svc, byte[] jerseyClientResp ) throws MPException {
}
}
And finally, the way it is used:
...
String levelFromUrl = getLevel(); // eg. "programmes"
MPUpdate resource;
resource = DomainResource.valueOf( levelFromUrl.toUpperCase() );
...
resource.apply( soapService, jerseyClientOutcome );
...
Any help? Does enum use performance enhancement for logging?
Many thanks
user6064240
source
share