cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

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

Explorer | Level 4

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
Highlighted

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

Dropboxer
Dropboxer
2 Replies 2
Highlighted

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

Dropboxer
Dropboxer
Highlighted

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

New member | Level 2
New member | Level 2

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

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?