Enum Class KnowledgePolicy.Presence

java.lang.Object
java.lang.Enum<KnowledgePolicy.Presence>
com.tnsai.annotations.KnowledgePolicy.Presence
All Implemented Interfaces:
Serializable, Comparable<KnowledgePolicy.Presence>, Constable
Enclosing class:
KnowledgePolicy

public static enum KnowledgePolicy.Presence extends Enum<KnowledgePolicy.Presence>
Whether a source must load when nothing configures it.
Since:
0.18.1
  • Enum Constant Details

    • MUST_LOAD

      public static final KnowledgePolicy.Presence MUST_LOAD
      The source loads from its declared path: a missing file fails the load, and an empty one loads as no content. The default.
    • WHEN_CONFIGURED

      public static final KnowledgePolicy.Presence WHEN_CONFIGURED
      The source is read only when a configuration points it elsewhere.

      A source is configured when a Config file or a run-time location moves its path to another file than the one its compiled Knowledge.path() names, both resolved against the working directory. A source only a configuration file declares is configured, and so is one whose path a configuration blanks: it reaches the loader, which refuses it. A source compiled with a blank path cannot be unconfigured, so it cannot be WHEN_CONFIGURED.

      • Unconfigured: the source loads as no content, and its file is never read, whether it is absent, empty or present.
      • Configured: the source loads as MUST_LOAD does. A host that checks readiness before a run (for example SCOPBridge.requireReady) also requires at least one unit from it.

      Valid for a FILE source only, and not for one read DIRECT, at role level or by an action: a DIRECT source is prompt text with nothing to fall back on.

  • Method Details

    • values

      public static KnowledgePolicy.Presence[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static KnowledgePolicy.Presence valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null