Class PropertyScope

java.lang.Object
org.openwms.core.preferences.PropertyScope
All Implemented Interfaces:
Serializable

public final class PropertyScope extends Object implements Serializable
A PropertyScope defines the different scopes for preferences. The built-in scopes APPLICATION, MODULE, ROLE, and USER are generic and always available. Downstream consumers can register additional domain-specific scopes (e.g. WAREHOUSE, TENANT) via the PropertyScopes registry without modifying this library. This enables a generic mechanism for scope extensibility while maintaining type safety and validation: registered scope names follow the pattern [A-Z][A-Z0-9_]*.
Author:
Heiko Scherrer
See Also:
  • Field Details

    • APPLICATION

      public static final PropertyScope APPLICATION
      This kind of preference belongs to the main application.
    • MODULE

      public static final PropertyScope MODULE
      This kind of preference is specific to a Module.
    • ROLE

      public static final PropertyScope ROLE
      This kind of preference belongs to a particular Role.
    • USER

      public static final PropertyScope USER
      This kind of preference belongs to a certain User.
    • name

      private final String name
  • Constructor Details

    • PropertyScope

      PropertyScope(String name)
      Creates a PropertyScope with the given name. The name must match the pattern [A-Z][A-Z0-9_]*.
      Parameters:
      name - the scope name, must not be blank and must match the validation pattern
      Throws:
      IllegalArgumentException - if the name is invalid
  • Method Details

    • of

      public static PropertyScope of(String name)
      Factory method to create or retrieve a PropertyScope. For the built-in scopes APPLICATION, MODULE, ROLE, and USER, returns the static constants. For custom scopes registered via PropertyScopes, returns a new instance if the name matches the validation pattern.
      Parameters:
      name - the scope name, must match [A-Z][A-Z0-9_]*
      Returns:
      a PropertyScope instance
      Throws:
      IllegalArgumentException - if the name is invalid
    • name

      public String name()
      Returns the name of this scope.
      Returns:
      the scope name
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object