You return a List<Syntax>
: Provider (Java EE 6 )
For example:
...
public class SyntaxProvider implements Provider<List<Syntax>>
{
List<Syntax> get() {...}
}
BTW maybe it should be SyntaxesProvider
instead of SyntaxProvider
since we return a list.
This component will not just be for the Syntax registry. It’s a standard component that any code can call to list the syntaxes provided by a given module/component.
We never said that a best practice for any component which want to provide stuff is to implement Provider.
We do that in general since it’s about following well known java design patterns: Factory, Provider, Singleton, Builder, etc. For me Provider is almost a JDK class and I see it similar to the functional interfaces that exist in Java (Runnable and the like). I really don’t see why we would reinvent the wheel here (I don’t see a single advantage actually - the naming is not a real advantage since it’s already in the name).