Skip to content

InMemorySkillProvider

This docs was updated at: 2026-02-23

com.paragon.skills.InMemorySkillProvider  ยท  Class

Implements SkillProvider


Stores code-defined skills in memory.

This provider is useful for skills defined directly in code without external files. It can be pre-populated with skills at construction time or skills can be registered dynamically.

Usage Examples

// Factory method with initial skills
SkillProvider provider = InMemorySkillProvider.of(skill1, skill2, skill3);
// Builder pattern
SkillProvider provider = InMemorySkillProvider.builder()
    .add(pdfSkill)
    .add(dataSkill)
    .build();
// Empty provider with dynamic registration
InMemorySkillProvider provider = InMemorySkillProvider.empty();
provider.register(newSkill);

See Also

  • SkillProvider
  • Skill

Since: 1.0

Methods

empty

public static @NonNull InMemorySkillProvider empty()

Creates an empty InMemorySkillProvider.

Returns

a new empty provider


of

public static @NonNull InMemorySkillProvider of(@NonNull Skill... skills)

Creates an InMemorySkillProvider with initial skills.

Parameters

Name Description
skills the skills to register

Returns

a new provider with the skills


builder

public static @NonNull Builder builder()

Creates a new builder for InMemorySkillProvider.

Returns

a new builder


register

public @NonNull InMemorySkillProvider register(@NonNull Skill skill)

Registers a skill in this provider.

If a skill with the same name already exists, it will be replaced.

Parameters

Name Description
skill the skill to register

Returns

this provider for chaining


registerAll

public @NonNull InMemorySkillProvider registerAll(@NonNull Skill... skills)

Registers multiple skills.

Parameters

Name Description
skills the skills to register

Returns

this provider for chaining


remove

public boolean remove(@NonNull String skillId)

Removes a skill from this provider.

Parameters

Name Description
skillId the skill name to remove

Returns

true if the skill was removed


clear

public void clear()

Clears all skills from this provider.


size

public int size()

Returns the number of registered skills.

Returns

skill count


add

public @NonNull Builder add(@NonNull Skill skill)

Adds a skill to the provider.

Parameters

Name Description
skill the skill to add

Returns

this builder


addAll

public @NonNull Builder addAll(@NonNull Skill... skills)

Adds multiple skills to the provider.

Parameters

Name Description
skills the skills to add

Returns

this builder


build

public @NonNull InMemorySkillProvider build()

Builds the InMemorySkillProvider.

Returns

the configured provider