-
-
Notifications
You must be signed in to change notification settings - Fork 342
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
[NO MERGE] Contextual Data API #2496
base: api-11
Are you sure you want to change the base?
Conversation
|
||
Iterable<DataPerspective> perceives(); | ||
|
||
ValueContainer getDataPerception(DataPerspective perspective); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should just be dataPerception(...)
no?
import org.checkerframework.checker.nullness.qual.Nullable; | ||
import org.spongepowered.api.data.value.Value; | ||
|
||
public interface DataPerspectiveResolver<V extends Value<E>, E> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this interface meant to be implemented? (DataRegistration below gives that impression).
If so, maybe it is best to make this abstract? I do not like a method that returns the key that isn't enforced to always return the same key (the instance could change).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is at the moment required to light up contextual data, otherwise we refuse to apply the data. I followed the same style we use for DataProvider
already, that also has getter for the key.
But it might be more beneficial to try to intergrade this whole concept to be part of DataProvider
to make them always be contextual aware, but that then touches a lot of core data API surface area.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's up to you as it's a commitment on your part but if you are up to it, I think this is a spot where we go all in and make DataProvider and the data API as a whole contextual aware. It was always meant to be, no one sat down to do it was always the issue.
Until now :).
Sponge | SpongeAPI
Open questions?
offerSingle
to the data perspective and the base entity already has elements. Append? Create new list with just that single item?Value<Integer>
could have addition, multiplication, etc.