| 29 | | public enum FileType { |
| 30 | | FILE, // the defaults |
| 31 | | IMAGE, |
| 32 | | FLASH, |
| 33 | | MEDIA |
| | 28 | public enum ResourceType { |
| | 29 | |
| | 30 | Image, File, Flash, Media; |
| | 31 | |
| | 32 | public String getPath() { |
| | 33 | return "/" + name().toLowerCase(); |
| | 34 | } |
| | 35 | |
| | 36 | public static ResourceType getDefaultResourceType(String name) { |
| | 37 | |
| | 38 | ResourceType rt = getResourceType(name); |
| | 39 | |
| | 40 | return rt == null ? File : rt; |
| | 41 | |
| | 42 | } |
| | 43 | |
| | 44 | public static ResourceType getResourceType(String name) { |
| | 45 | |
| | 46 | try { |
| | 47 | return ResourceType.valueOf(name); |
| | 48 | } catch (IllegalArgumentException e) { |
| | 49 | return null; |
| | 50 | } catch (NullPointerException e) { |
| | 51 | return null; |
| | 52 | } |
| | 53 | } |
| | 54 | |
| | 55 | public static boolean isValid(final String name) { |
| | 56 | return getResourceType(name) == null ? false : true; |
| | 57 | } |
| | 58 | |