Skip to content

Conversation

@gsvic
Copy link
Contributor

@gsvic gsvic commented May 4, 2020

Added the getMetadataMap method, which returns a HashMap containing the Array metadata in a key-value manner.

@gsvic gsvic requested a review from Shelnutt2 May 4, 2020 13:06
@gsvic gsvic force-pushed the vg/feature/ArrayMetadataGet branch from 2f9c4cb to ce660cc Compare May 4, 2020 13:07
@gsvic gsvic mentioned this pull request May 4, 2020
* @return The metadata
* @throws TileDBError
*/
public Map<String, Object> getMetadataMap() throws TileDBError {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, so we need to know the metadata type for the each key ahead of time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea behind that is that we can get the class of each object returned using .getClass. We could also provide the type as well, by returning something like Pair<NativeArray, Datatype> or Pair<Object, Datatype> but this would make the API more complex, without providing something more than .getClass() provides.

So we need either know the metadata type ahead of time or consider do some type-check before reading each value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OH, Java! Forgetting about it always; LGTM than! I will remove this method from my PR than and can leave only a simple putMetadata overload :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! You can take a look here on how to use the .getClass() method: https://docs.oracle.com/javase/tutorial/reflect/class/classNew.html

You can also take a look on how getClass() is used in that unit test: https://github.com/TileDB-Inc/TileDB-Java/pull/157/files#diff-d38ae1adae50d20e357b8edd3c64de26R554

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gsvic thanks ;) I'm just looking at everything through the prism of a typed API (got used to it after years in Scala).

@gsvic gsvic merged commit 2260504 into master May 4, 2020
@gsvic gsvic deleted the vg/feature/ArrayMetadataGet branch June 3, 2020 13:05
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

Successfully merging this pull request may close these issues.

4 participants