Module jdk.jshell
Package jdk.jshell

Enum Class Snippet.Kind

java.lang.Object
java.lang.Enum<Snippet.Kind>
jdk.jshell.Snippet.Kind
All Implemented Interfaces:
Serializable, Comparable<Snippet.Kind>, Constable
Enclosing class:
Snippet

public static enum Snippet.Kind extends Enum<Snippet.Kind>
Describes the general kind of snippet. The Kind is an immutable property of a Snippet. It is accessed with Snippet.kind(). The Kind can be used to determine which subclass of Snippet it is. For example, eval("int three() { return 3; }") will return a snippet creation event. The Kind of that Snippet will be METHOD, from which you know that the subclass of Snippet is MethodSnippet and it can be cast as such.
  • Enum Constant Details

  • Method Details

    • values

      public static Snippet.Kind[] 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 Snippet.Kind 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
    • isPersistent

      public boolean isPersistent()
      Indicates whether this Kind of Snippet is persistent. Only declarations are persistent because they influence future Snippets.

      Note that though the Kind of a Snippet may be persistent, that does not mean that the Snippet will persist; For example it may be invalid or have been dropped. See: Snippet.Status.isDefined().

      Returns:
      true if this Kind of Snippet is visible to subsequent evaluations; otherwise false