cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
If you’ve changed your email address, now's the perfect time to update it on your Dropbox account and we’re here to help! Learn more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[Java SDK V2] How to distinguish if Metadata is file or folder

[Java SDK V2] How to distinguish if Metadata is file or folder

michal_k
Explorer | Level 4
Go to solution

Hello,

 

I need to distunguish, if Metadata I got is file or folder. Is there any recommended way, how to do this? I came up just with using instanceof operator, here is a snippet from integration tests:

 

 

        final Metadata fileMetadata = client.files().getMetadata(destFile);
        assertTrue(fileMetadata instanceof FileMetadata);
final Metadata folderMetadata = client.files().getMetadata(destFolder); assertTrue(folderMetadata instanceof FolderMetadata);

 

Is there any recomended way?

 

Thank you,

 

Michal

1 Accepted Solution

Accepted Solutions
2 Replies 2

Greg-DB
Dropbox Staff
Go to solution

jovier m.
New member | Level 2
Go to solution

Java instanceof is a keyword. It is a binary operator used to test if an object (instance) is a subtype of a given Type. It returns either true or false. More about...instanceof keyword

 

Mark

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    jovier m. New member | Level 2
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?