private RpcBatch . Callback < Change > createChangeRequestCallback ( final String zoneName , final DnsBatchResult < ChangeRequest > result , final boolean nullForNotFound , final boolean idempotent ) { return new RpcBatch . Callback < Change > ( ) { @ Override public void onSuccess ( Change response ) { result . success ( response == null ? null : ChangeRequest . fromPb ( options . getService ( ) , zoneName , response ) ) ; } @ Override public void onFailure ( GoogleJsonError googleJsonError ) { DnsException serviceException = new DnsException ( googleJsonError , idempotent ) ; if ( serviceException . getCode ( ) == HTTP_NOT_FOUND ) { if ( "entity.parameters.changeId" . equals ( serviceException . getLocation ( ) ) || ( serviceException . getMessage ( ) != null && serviceException . getMessage ( ) . contains ( "parameters.changeId" ) ) ) { // the change id was not found, but the zone exists result . success ( null ) ; return ; } // the zone does not exist, so throw an exception } result . error ( serviceException ) ; } } ; }
A joint callback for both get change request and create change request operations .