Skip to content

BaseProfile ​

com.jsmacrosce.jsmacros.core.config.BaseProfile

Since1.2.7

Manages a core's active profile and the event and library registries initialized for it.

Constructors ​

new BaseProfile ​

new BaseProfile(Core runner, Logger logger)#
Stores the supplied core and logger references; registry setup and profile loading are performed by init(String).

Parameters:

  • runner: core associated with this profile
  • logger: logger for profile diagnostics

Fields ​

joinedThreadStack ​

joinedThreadStack: Set<Thread>read-only#
Threads joined during joined-main event dispatch, removed after their callbacks are awaited or interrupted. This mutable set is neither a thread stack nor a record of all running threads.

LOGGER ​

LOGGER: Loggerread-only#
Logger supplied for this profile's diagnostics.

profileName ​

profileName: String#
Current profile name, or null until one is assigned; this name is used as the save key.

runner ​

runner: Core<?, ?>read-only#
Core associated with this profile.

Methods ​

checkJoinedThreadStack ​

checkJoinedThreadStack(): booleanSince1.6.0#
Reports whether the current thread's joined-event stack permits joined dispatch.
Returns: true if joined dispatch is permitted for the current thread

getCurrentProfileName ​

getCurrentProfileName(): String#
Returns the current stored profile name.
Returns: current name, or null before one is assigned

init ​

init(String defaultProfile): void#
Initializes registries, then loads or creates the default profile.

Parameters:

  • defaultProfile: name of the profile to load or create

loadOrCreateProfile ​

loadOrCreateProfile(String profileName): voidSince1.0.9#
Loads the named profile, creating and persisting an empty profile when its name is absent from configuration.

Parameters:

  • profileName: name of the profile to load or create

logError ​

logError(Throwable ex): void#
Reports a failure through this profile's error-handling implementation.

Parameters:

  • ex: failure to report

renameCurrentProfile ​

renameCurrentProfile(String profile): void#
Assigns the current profile name without renaming a configured profile entry or persisting configuration.

Parameters:

  • profile: new current profile name

saveProfile ​

saveProfile(): voidSince1.0.0#
Saves the registered script triggers under the current profile name and persists the configuration.

triggerEvent ​

triggerEvent(BaseEvent event): voidSince1.2.7#
Dispatches an event to its named listeners and, unless ignored, to ANYTHING listeners. Joined dispatch is used for joined listeners or cancellable events when the event is joinable (or its name is configured as joinable); joined callbacks are awaited.

Parameters:

  • event: event to dispatch