Enum Class IntentionallyStatic.Reason

java.lang.Object
java.lang.Enum<IntentionallyStatic.Reason>
com.vaadin.swingbridge.migration.IntentionallyStatic.Reason
All Implemented Interfaces:
Serializable, Comparable<IntentionallyStatic.Reason>, Constable
Enclosing class:
IntentionallyStatic

public static enum IntentionallyStatic.Reason extends Enum<IntentionallyStatic.Reason>
The four sanctioned reasons to leave a field at application scope, one per terminal verdict of the sweep's decision tree. Closed on purpose: a field fitting none of them gets routed instead of argued over.
  • Enum Constant Details

    • IMMUTABLE_CONSTANT

      public static final IntentionallyStatic.Reason IMMUTABLE_CONSTANT
      A constant of a mutable type that is never mutated — List.of(…), an array written once and only read.

      Evidence: no write reference outside initialization, and no mutating call on the object. If either exists, this is the wrong reason.

    • WORLD_GLOBAL_READ_MOSTLY

      public static final IntentionallyStatic.Reason WORLD_GLOBAL_READ_MOSTLY
      State global to all users rather than to the app, and read-mostly: immutable configuration, read-only reference data. The tree's test — does the state come from, or feed, a resource outside the process (the database, the classpath, deployment config)?

      Read-mostly is a query, not an impression: no write reference outside initialization, counting the field's own initializer, a static { } block and a guarded lazy-init (if (x == null) x = …) as initialization and everything else as mutation.

      A cache the app writes on save is not this — the write query refutes the claim. Such a cache is still correct shared and stale per-tab, so it stays at application scope; it just belongs under JVM_INFRASTRUCTURE, or with the sharing fixed at its source.

    • JVM_INFRASTRUCTURE

      public static final IntentionallyStatic.Reason JVM_INFRASTRUCTURE
      A process-level service rather than data: a connection pool, a Hibernate SessionFactory, a logger, a thread pool. Correct as a static for the same reason it was on the desktop, and the migration leaves it alone.

      Note the boundary — the factory belongs here; a current session or current transaction does not, being per-user or per-call.

    • COUNTER

      public static final IntentionallyStatic.Reason COUNTER
      A monotonic counter, sequence or accumulator, where sharing across users is the feature: it behaves like a database sequence, so gaps and interleaving are fine. The opposite default from user-specific state.

      The exception, and why IntentionallyStatic.note() is worth writing here: move it to session scope when a user must see a contiguous private sequence — the number is shown to them as "your record #1, #2, #3" and must not skip.

  • Method Details

    • values

      public static IntentionallyStatic.Reason[] 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 IntentionallyStatic.Reason 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