Class PlaceholderStore
This store owns the placeholder lookup table so that the component producing placeholders
(PlaceholderRegistry) and the component consuming them
(PAPIExpansion) can both depend on a shared,
neutral collaborator instead of on each other. Decoupling the lookup from both sides breaks the
registry/expansion dependency cycle while keeping a single source of truth for placeholder data.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all registered placeholders.@Nullable PlaceholderMetadatafindPlaceholderMetadata(@NotNull String params) Finds the placeholder metadata matching the given parameter string.voidregister(@NotNull PlaceholderMetadata metadata) Registers placeholder metadata, keyed by its placeholder pattern.
-
Constructor Details
-
PlaceholderStore
public PlaceholderStore()
-
-
Method Details
-
register
Registers placeholder metadata, keyed by its placeholder pattern.Re-registering the same pattern overwrites the previous metadata.
- Parameters:
metadata- the placeholder metadata to store, not null
-
findPlaceholderMetadata
@Nullable public @Nullable PlaceholderMetadata findPlaceholderMetadata(@NotNull @NotNull String params) Finds the placeholder metadata matching the given parameter string.An exact key match takes precedence: if a placeholder is registered under exactly
paramsit is returned directly. Otherwise the first placeholder whose parameter syntax accepts the supplied value is returned (seePlaceholderParameterParser.isValidPlaceholderPattern(String, String)). Resolving exact matches first keeps lookup deterministic regardless of map iteration order.- Parameters:
params- the placeholder parameter string requested, not null- Returns:
- the matching metadata, or
nullif none matches
-
clear
public void clear()Removes all registered placeholders.
-