1 package org.simantics.scl.compiler.internal.header;
3 import org.simantics.scl.compiler.elaboration.expressions.annotations.AnnotationUtils;
4 import org.simantics.scl.compiler.elaboration.expressions.records.FieldAssignment;
5 import org.simantics.scl.compiler.errors.ErrorLog;
6 import org.simantics.scl.compiler.internal.parsing.declarations.DModuleHeader;
8 public class ModuleHeader {
9 public String classLoader;
10 public long classLoaderLocation;
12 private void read(ErrorLog errorLog, DModuleHeader header) {
13 for(FieldAssignment assignment : header.fields)
14 switch(assignment.name) {
16 if(assignment.value == null)
17 errorLog.log(assignment.location, "Property classLoader needs to be given a string value.");
19 classLoader = AnnotationUtils.extractString(assignment.value);
20 if(classLoader == null)
21 errorLog.log(assignment.value.location, "Expected bundle name here.");
23 classLoaderLocation = assignment.location;
27 errorLog.logWarning(assignment.location, "Unknown module header field was skipped.");
31 public static ModuleHeader process(ErrorLog errorLog, DModuleHeader header) {
34 ModuleHeader result = new ModuleHeader();
35 result.read(errorLog, header);