Class ResourceManager

java.lang.Object
com.nomagic.magicdraw.resources.ResourceManager

@OpenApiAll public class ResourceManager extends Object
This class is used to retrieve the resources from the resource bundle files
  • Field Details

  • Constructor Details

    • ResourceManager

      public ResourceManager()
  • Method Details

    • getMetaModelResource

      public static String getMetaModelResource(Class type)
      Returns meta model resource.
    • getMetaModelResource

      public static String getMetaModelResource(MDElement presentationElement)
      Returns meta model resource.
    • getMetaModelResource

      public static String getMetaModelResource(javax.jmi.reflect.RefObject element)
      Returns meta model resource.
    • getStringFor

      public static String getStringFor(String key, int bundle)
      Get string according to key and bundle id. If there are no such - returns key.
      Parameters:
      key - Key to fetch string
      bundle - Bundle ID
      Returns:
      String for key from given bundle.
    • getStringFor

      public static String getStringFor(String key, String bundleName, @CheckForNull ClassLoader loader)
      Get string according to key and bundle id. If there are no such - returns key.
      Parameters:
      key - Key to fetch string
      bundleName - Bundle name
      loader - loader to load resources
      Returns:
      String for key from given bundle.
    • getStringOrElse

      public static String getStringOrElse(String key, String bundleName, @CheckForNull ClassLoader loader, Supplier<String> alternative)
      Get string according to key and bundle id. If there is no such - returns alternative from the passed in supplier.
      Parameters:
      key - Key to fetch string
      bundleName - Bundle name
      loader - loader to load resources
      alternative - result to be returned in case key or bundle is not found
      Returns:
      String for key from given bundle, or alternative if the key or bundle is not found
    • getStringFor

      public static String getStringFor(String key, int bundle, String messageArguments)
      Get string according to key and bundle id. If there are no such - returns key. Can retrieve customizable message bundles.
      Parameters:
      key - Key to fetch string
      bundle - Bundle ID
      messageArguments - Set of the message bundle arguments.
      Returns:
      String for key from given bundle.
    • getStringFor

      public static String getStringFor(String key, int bundle, @CheckForNull Object[] messageArguments)
      Get string according to key and bundle id. If there are no such - returns key. Can retrieve customizable message bundles.
      Parameters:
      key - Key to fetch string
      bundle - Bundle id
      messageArguments - Set of the message bundle arguments.
      Returns:
      String for key from given bundle.
    • formatMessage

      public static String formatMessage(String message, String... arguments)
    • formatMessage

      public static String formatMessage(Object[] messageArguments, String message)
    • getLocale

      public static Locale getLocale()
      Gets set locale. If there are no such - creates default.
      Returns:
      locale, which is used for bundles
    • getLocaleInfo

      public static LocaleInfo getLocaleInfo()
    • setLocale

      public static void setLocale(Locale locale)
    • setLocale

      public static void setLocale(LocaleInfo localeInfo)
      Sets locale. This operation is called only when is read environment options
      Parameters:
      localeInfo - Bundles will be chosen according this locale
    • getAvailableLanguages

      public static Set<String> getAvailableLanguages()
    • createAvailableLanguages

      public static void createAvailableLanguages()
      Creates Available language.
    • fillAvailableLanguagesFromBundleInJar

      public static void fillAvailableLanguagesFromBundleInJar(Collection<String> languages, URL location)
    • getEntriesUnderPath

      public static List<JarEntry> getEntriesUnderPath(JarFile jar, Predicate<JarEntry> pred)