Class APISource

java.lang.Object
ml.karmaconfigs.api.common.karma.APISource
All Implemented Interfaces:
Serializable, KarmaSource

public final class APISource extends Object implements KarmaSource
Karma API source
See Also:
Serialized Form
  • Field Details

    • DEFAULT_SOURCE

      @ScheduledForRemoval @Deprecated public static String DEFAULT_SOURCE
      Deprecated.
      Default source name
  • Method Details

    • addProvider

      public static void addProvider(KarmaSource src) throws IllegalStateException
      Add a new karma source provider
      Parameters:
      src - the karma source
      Throws:
      IllegalStateException - if the source is already added
    • updateProvider

      public static void updateProvider(String name, KarmaSource target) throws IllegalStateException
      Update a source provider
      Parameters:
      name - the original source name
      target - the new source
      Throws:
      IllegalStateException - if the new source replacement is not the same as the stored one
    • hasProvider

      public static boolean hasProvider(String name)
      Get if the API source has stored a source with the specified name
      Parameters:
      name - the source name
      Returns:
      if the API source has that source
    • loadProvider

      public static KarmaSource loadProvider(String name) throws IllegalArgumentException
      Load a provider
      Parameters:
      name - the provider name
      Returns:
      the karma source attached to that name
      Throws:
      IllegalArgumentException - if the source is not registered
    • defineDefault

      public static void defineDefault(KarmaSource def) throws SecurityException
      Define the default source that KarmaAPI will use. Differently from static is that method throws error if there's already a default source set.
      Parameters:
      def - the default source
      Throws:
      SecurityException
    • getOriginal

      public static KarmaSource getOriginal(boolean forceKarma)
      Get the original karma source
      Parameters:
      forceKarma - force KarmaAPI provider
      Returns:
      the original karma source
    • name

      public String name()
      Karma source name
      Specified by:
      name in interface KarmaSource
      Returns:
      the source name
    • version

      public String version()
      Karma source version
      Specified by:
      version in interface KarmaSource
      Returns:
      the source version
    • description

      public String description()
      Karma source description
      Specified by:
      description in interface KarmaSource
      Returns:
      the source description
    • authors

      public String[] authors()
      Karma source authors
      Specified by:
      authors in interface KarmaSource
      Returns:
      the source authors
    • updateURL

      public String updateURL()
      Karma source update URL
      Specified by:
      updateURL in interface KarmaSource
      Returns:
      the source update URL