bson/src/main/org/bson/BsonBinary.java
public UUID asUuid() {
        if (!BsonBinarySubType.isUuid(type)) {
            throw new BsonInvalidOperationException("type must be a UUID subtype.");
        }

        if (type != BsonBinarySubType.UUID_STANDARD.getValue()) {
            throw new BsonInvalidOperationException("uuidRepresentation must be set to return the correct UUID.");
        }

        return UuidHelper.decodeBinaryToUuid(this.data.clone(), this.type, UuidRepresentation.STANDARD);
    }
public UUID asUuid() {
        if (!BsonBinarySubType.isUuid(type)) {
            throw new BsonInvalidOperationException("type must be a UUID subtype.");
        }

        if (type != BsonBinarySubType.UUID_STANDARD.getValue()) {
            throw new BsonInvalidOperationException("uuidRepresentation must be set to return the correct UUID.");
        }

        return UuidHelper.decodeBinaryToUuid(this.data.clone(), this.type, UuidRepresentation.STANDARD);
    }
public UUID asUuid ( ) { if ( ! BsonBinarySubType . isUuid ( type ) ) { throw new BsonInvalidOperationException ( "type must be a UUID subtype." ) ; } if ( type != BsonBinarySubType . UUID_STANDARD . getValue ( ) ) { throw new BsonInvalidOperationException ( "uuidRepresentation must be set to return the correct UUID." ) ; } return UuidHelper . decodeBinaryToUuid ( this . data . clone ( ) , this . type , UuidRepresentation . STANDARD ) ; }
Returns the binary as a UUID. The binary type must be 4.

@return the uuid
@since 3.9
Returns the binary as a UUID . The binary type must be 4 .