public static WriteConcernResult unacknowledged ( ) { return new WriteConcernResult ( ) { @ Override public boolean wasAcknowledged ( ) { return false ; } @ Override public int getCount ( ) { throw getUnacknowledgedWriteException ( ) ; } @ Override public boolean isUpdateOfExisting ( ) { throw getUnacknowledgedWriteException ( ) ; } @ Override public BsonValue getUpsertedId ( ) { throw getUnacknowledgedWriteException ( ) ; } @ Override public boolean equals ( final Object o ) { if ( this == o ) { return true ; } if ( o == null || getClass ( ) != o . getClass ( ) ) { return false ; } WriteConcernResult that = ( WriteConcernResult ) o ; return ! that . wasAcknowledged ( ) ; } @ Override public int hashCode ( ) { return 1 ; } @ Override public String toString ( ) { return "UnacknowledgedWriteResult{}" ; } private UnsupportedOperationException getUnacknowledgedWriteException ( ) { return new UnsupportedOperationException ( "Cannot get information about an unacknowledged write" ) ; } } ; }
Create an unacknowledged WriteConcernResult