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 .