Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uri of RowReference #138

Open
dmfs opened this issue Nov 26, 2017 · 1 comment
Open

Uri of RowReference #138

dmfs opened this issue Nov 26, 2017 · 1 comment

Comments

@dmfs
Copy link
Owner

dmfs commented Nov 26, 2017

In order to communicate the Uri of a newly inserted row, I want a mechanism to retrieve the Uri from a RowReference, if possible.

There are conditions under which a RowReference can't be expressed as a Uri, namely when the respective row has not been committed yet or when the TransactionContext of that transaction is not available. So we probably have to consider an Optional<Uri>.

This is similar to a "serialize"/"unserialize" mechanism for RowReferences to committed rows, because with RowUriReference you can easily create a RowReference from a Uri.

@dmfs
Copy link
Owner Author

dmfs commented Nov 26, 2017

Implementation idea.

We add another method to RowReference which returns an Optional<Uri>.

public interface RowReference<T>
{
    …
    /** Returns the Optional Uri of the row this refers to. */
    @NonNull 
    Optional<Uri> rowUri(@NonNull TransactionContext transactionContext);
}

Some RowReferences don't know their table Uri, so we'll also have to extend the Table interface like so:

public interface Table<T>
{
    …
    /** Returns the Uri of a row with the given row id*/
    @NonNull
    Uri rowUri(long id);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant