Class CommandMeta

  • Direct Known Subclasses:
    SimpleCommandMeta

    public abstract class CommandMeta
    extends java.lang.Object
    Object that is associated with a Command. Command meta should not be mutable, as one fixed instance will be used per command.

    Appropriate use for command meta would be fixed state, such as command descriptions.

    • Constructor Summary

      Constructors 
      Constructor Description
      CommandMeta()  
    • Method Summary

      Modifier and Type Method Description
      abstract @NonNull java.util.Map<@NonNull java.lang.String,​@NonNull java.lang.String> getAll()
      Get a copy of the meta map
      abstract @NonNull java.lang.String getOrDefault​(@NonNull java.lang.String key, @NonNull java.lang.String defaultValue)
      Get the value if it exists, else return the default value
      abstract @NonNull java.util.Optional<java.lang.String> getValue​(@NonNull java.lang.String key)
      Get the value associated with a key
      static @NonNull SimpleCommandMeta.Builder simple()
      Create a new simple command meta builder
      @NonNull java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CommandMeta

        public CommandMeta()
    • Method Detail

      • simple

        public static @NonNull SimpleCommandMeta.Builder simple()
        Create a new simple command meta builder
        Returns:
        Builder instance
      • toString

        public final @NonNull java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getValue

        public abstract @NonNull java.util.Optional<java.lang.String> getValue​(@NonNull java.lang.String key)
        Get the value associated with a key
        Parameters:
        key - Key
        Returns:
        Optional that may contain the associated value
      • getOrDefault

        public abstract @NonNull java.lang.String getOrDefault​(@NonNull java.lang.String key,
                                                               @NonNull java.lang.String defaultValue)
        Get the value if it exists, else return the default value
        Parameters:
        key - Key
        defaultValue - Default value
        Returns:
        Value, or default value
      • getAll

        public abstract @NonNull java.util.Map<@NonNull java.lang.String,​@NonNull java.lang.String> getAll()
        Get a copy of the meta map
        Returns:
        Copy of meta map