As my first point, and already mentioned in a comment, all variable names should be written in English.
This makes it possible for non-Portuguese speakers to understand the code.
The code should be self-explainatory.
The method name should be isValidDirectory.
Boolean methods begin with isSomething, like if you were asking a question.
Since you are 'asking' if a directory has some defined attributes, you should reflect this in your method name.
Based on your current name, I wouldn't expect it to return true if it had a file there.
One example of this is the method String.isNullOrEmpty.
You have another example on the following line:
if (allFiles.isEmpty() && validacao.getSpec() == null) {
Taken from your code.
At the end, you have the following code:
} else if (!allFiles.isEmpty()) {
String files = allFiles.toString();
if (files.contains("swf") || files.contains("jpg") || files.contains("gif")) {
return false;
}
}
This can be changed into this (assuming the change in the method name):
} else if (!allFiles.isEmpty()) {
String files = allFiles.toString();
return files.contains(".swf") && files.contains(".jpg") && files.contains(".gif");
}
Since that expression will return a boolean value, you can send it directly.
Also, I've added a . to the filenames, because one could name a file jpg.c and it would validate.
I don't think this is the right way to check if those parameters are met, since you may have a file named a.jpeg and it would fail, even though it is a perfectly valid extension.
Even a.JPG would fail!
Java isn't my beach and it really is outside my confort area, but I recommend a method where you itterate over all the elements and check, with a Regular Expression, if the extension is indeed valid.