ILanguageService

public interface ILanguageService

Interface for a language service that creates and destroys languages, maps names to active languages, and provides an observable of language changes. A language is active if it has the highest version, and highest loading date.

Methods

add

ILanguageComponent add(ComponentCreationConfig config)

Adds language component created from given configuration object, and return the created component.

Parameters:
  • config – Request object to process.
Throws:
  • IllegalStateException – When a component with a different id has already been created at given component’s location.
Returns:

Created component.

componentChanges

Observable<LanguageComponentChange> componentChanges()
Returns:Observable over language component changes.

create

ComponentCreationConfig create(LanguageIdentifier identifier, FileObject location, Iterable<LanguageContributionIdentifier> contribs, ILanguageComponentConfig config)

Creates a request object with given identifier and location, contributing to given language implementation identifiers. Returns a request object where facets can be added before passing it to add(ComponentCreationConfig).

Parameters:
  • identifier – Identifier of the component to create.
  • location – Location of the component to create.
  • contribs – Identifiers of language implementations that the component should contribute to.
  • config – Configuration of the component to create.
Returns:

Creation request object, when passed to add(ComponentCreationConfig) actually adds the language.

getAllComponents

Iterable<? extends ILanguageComponent> getAllComponents()
Returns:All language components.

getAllImpls

Iterable<? extends ILanguageImpl> getAllImpls()
Returns:All language implementations.

getAllImpls

Iterable<? extends ILanguageImpl> getAllImpls(String groupId, String id)

Gets language implementations with group id and id.

Parameters:
  • groupId – Group ID of the implementations to get.
  • id – ID of the implementations to get.
Returns:

Implementations with given group id and id.

getAllLanguages

Iterable<? extends ILanguage> getAllLanguages()
Returns:All languages

getComponent

ILanguageComponent getComponent(LanguageIdentifier identifier)

Gets a language component by its identifier.

Parameters:
  • identifier – Identifier of the implementation to get.
Returns:

Component with given identifier, or null if it could not be found.

getComponent

ILanguageComponent getComponent(FileName location)

Gets a language component by its location.

Parameters:
  • location – Location of the implementation to get.
Returns:

Component at given location, or null if it could not be found.

getImpl

ILanguageImpl getImpl(LanguageIdentifier identifier)

Gets a language implementation by its identifier.

Parameters:
  • identifier – Identifier of the implementation to get.
Returns:

Implementation with given identifier, or null if it could not be found.

getLanguage

ILanguage getLanguage(String name)

Gets a language by its name.

Parameters:
  • name – Name of the language to get.
Returns:

Language with given name, or null if it could not be found.

implChanges

Observable<LanguageImplChange> implChanges()
Returns:Observable over language implementation changes.

remove

void remove(ILanguageComponent component)

Removes given language component.

Parameters:
  • component – Language component to remove.
Throws: