Added Document subclasses
This commit is contained in:
@@ -4,8 +4,22 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public enum FileType {
|
||||
IMAGE, PLAINTEXT, FILE, CODE;
|
||||
IMAGE("Image"), PLAINTEXT("Plaintext"), FILE("File"), CODE("Code"), NONE("None");
|
||||
public List<String> typeExtensions;
|
||||
public final String typeName;
|
||||
|
||||
FileType(String typeName) {
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
public static FileType getFileType(String extension) {
|
||||
for (FileType fileType : values()) {
|
||||
if (fileType.typeExtensions.contains(extension.toLowerCase())) {
|
||||
return fileType;
|
||||
}
|
||||
}
|
||||
return NONE;
|
||||
}
|
||||
|
||||
static {
|
||||
IMAGE.typeExtensions = new ArrayList<>(List.of("jpg", "png"));
|
||||
|
||||
Reference in New Issue
Block a user