Class CommandMeta

java.lang.Object
cloud.commandframework.meta.CommandMeta
Direct Known Subclasses:
SimpleCommandMeta

@API(status=STABLE) public abstract class CommandMeta extends 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.

  • Field Details

  • Constructor Details

    • CommandMeta

      public CommandMeta()
  • Method Details

    • simple

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

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

      @Deprecated @API(status=DEPRECATED, since="1.3.0") public abstract @NonNull Optional<String> getValue(@NonNull String key)
      Deprecated.
      for removal since 1.3.0, see typesafe variant at get(Key) instead
      Get the value associated with a key
      Parameters:
      key - Key
      Returns:
      Optional that may contain the associated value
    • getOrDefault

      @Deprecated @API(status=DEPRECATED, since="1.3.0") public abstract @NonNull String getOrDefault(@NonNull String key, @NonNull String defaultValue)
      Deprecated.
      for removal since 1.3.0, see typesafe variant at getOrDefault(Key, Object) instead
      Get the value if it exists, else return the default value
      Parameters:
      key - Key
      defaultValue - Default value
      Returns:
      Value, or default value
    • get

      @API(status=STABLE, since="1.3.0") public abstract <V> @NonNull Optional<V> get(@NonNull CommandMeta.Key<V> key)
      Get the value associated with a key.
      Type Parameters:
      V - Value type
      Parameters:
      key - Key
      Returns:
      Optional that may contain the associated value
      Since:
      1.3.0
    • getOrDefault

      @API(status=STABLE, since="1.3.0") public abstract <V> @NonNull V getOrDefault(@NonNull CommandMeta.Key<V> key, @NonNull V defaultValue)
      Get the value if it exists, else return the default value.
      Type Parameters:
      V - Value type
      Parameters:
      key - Key
      defaultValue - Default value
      Returns:
      Value, or default value
      Since:
      1.3.0
    • getAll

      @Deprecated @API(status=DEPRECATED, since="1.3.0") public abstract @NonNull Map<@NonNull String,@NonNull String> getAll()
      Deprecated.
      for removal since 1.3.0, use getAllValues() instead.
      Get a copy of the meta map
      Returns:
      Copy of meta map
    • getAllValues

      @API(status=STABLE, since="1.3.0") public abstract @NonNull Map<@NonNull String,@NonNull ?> getAllValues()
      Get a copy of the meta map, without type information.
      Returns:
      Copy of meta map
      Since:
      1.3.0