Class ResourceUtil


  • public class ResourceUtil
    extends java.lang.Object
    • Field Detail

      • INVALID_WINDOWS_FILENAMES

        public static final java.util.List<java.lang.String> INVALID_WINDOWS_FILENAMES
        Filenames that are reserved for use by the Windows OS, and will cause errors if you attempt to create them on the filesystem.
      • SORT_BY_MOST_RECENT

        public static final java.util.Comparator<ProjectResource> SORT_BY_MOST_RECENT
    • Method Detail

      • getResourceName

        public static java.lang.String getResourceName​(ProjectResourceId id)
      • decodeOrCreate

        public static <T> T decodeOrCreate​(ProjectResource r,
                                           XMLDeserializer deserializer,
                                           java.lang.Class<T> clazz,
                                           LoggerEx log)
                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • decodeOrNull

        @Nullable
        public static <T> T decodeOrNull​(ProjectResource r,
                                         XMLDeserializer deserializer,
                                         java.lang.Class<T> clazz)
                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getValidResourceName

        @Nullable
        public static java.lang.String getValidResourceName​(java.lang.String resourceName)
        Returns:
        a resource name that can be written to disk. In the case of a singletons, a null value or an improper name returns null.
      • getValidFolderName

        public static java.lang.String getValidFolderName​(java.lang.String folderName)
      • isLegalName

        public static boolean isLegalName​(java.lang.String proposedName)
        Returns:
        true if this resource name is valid for all supported filesystems
      • isLegalForLocation

        public static boolean isLegalForLocation​(@Nonnull
                                                 Project project,
                                                 @Nonnull
                                                 java.lang.String proposedName,
                                                 @Nonnull
                                                 ResourcePath location)
        Returns:
        true if this resource can be added to the specified project