added first deps implementation
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
package p.studio.compiler;
|
||||
|
||||
import p.studio.compiler.model.FrontendSpec;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class FrontendRegistryService {
|
||||
private static final FrontendSpec[] FRONTEND_SPECS = {
|
||||
PBSDefinitions.PBS,
|
||||
};
|
||||
|
||||
private static final Map<String, FrontendSpec> FRONTENDS = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (final var frontendSpec : FRONTEND_SPECS) {
|
||||
FRONTENDS.put(frontendSpec.getLanguageId(), frontendSpec);
|
||||
}
|
||||
if (FRONTENDS.size() != FRONTEND_SPECS.length) throw new IllegalStateException("Duplicate frontend specs found");
|
||||
}
|
||||
|
||||
public static FrontendSpec getDefaultFrontendSpec() {
|
||||
return FRONTENDS.get(PBSDefinitions.PBS.getLanguageId());
|
||||
}
|
||||
|
||||
public static Optional<FrontendSpec> getFrontendSpec(final String languageId) {
|
||||
return Optional.ofNullable(FRONTENDS.get(languageId));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user