|
@@ -11,11 +11,13 @@
|
|
|
package org.yakindu.sct.generator.genmodel.typesystem
|
|
|
|
|
|
import com.google.inject.Inject
|
|
|
+import com.google.inject.Singleton
|
|
|
+import org.eclipse.emf.ecore.resource.Resource
|
|
|
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl
|
|
|
import org.eclipse.xtend.lib.annotations.Accessors
|
|
|
import org.yakindu.base.types.Property
|
|
|
import org.yakindu.base.types.Type
|
|
|
import org.yakindu.base.types.TypesFactory
|
|
|
-import org.yakindu.base.types.typesystem.AbstractTypeSystem
|
|
|
import org.yakindu.base.types.typesystem.ITypeSystem
|
|
|
import org.yakindu.sct.model.sgen.util.BuiltinDeclarationNames
|
|
|
|
|
@@ -24,6 +26,7 @@ import org.yakindu.sct.model.sgen.util.BuiltinDeclarationNames
|
|
|
*
|
|
|
*/
|
|
|
@Accessors(PUBLIC_GETTER)
|
|
|
+@Singleton
|
|
|
class BuiltinDeclarations implements BuiltinDeclarationNames {
|
|
|
protected TypesFactory typesFactory
|
|
|
protected ITypeSystem typeSystem
|
|
@@ -33,23 +36,24 @@ class BuiltinDeclarations implements BuiltinDeclarationNames {
|
|
|
protected Property hostname
|
|
|
protected Property username
|
|
|
|
|
|
+ protected Resource builtinResource
|
|
|
+
|
|
|
@Inject
|
|
|
new(ITypeSystem typeSystem) {
|
|
|
this.typesFactory = TypesFactory.eINSTANCE
|
|
|
this.typeSystem = typeSystem
|
|
|
-
|
|
|
+ builtinResource = new XMIResourceImpl
|
|
|
val stringtype = typeSystem.getType(ITypeSystem.STRING)
|
|
|
-
|
|
|
sct_version = createProperty(SCT_VERSION_VAR, stringtype)
|
|
|
timestamp = createProperty(TIMESTAMP_VAR, stringtype)
|
|
|
hostname = createProperty(HOSTNAME_VAR, stringtype)
|
|
|
username = createProperty(USER_VAR, stringtype)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
def protected Property createProperty(String name, Type type) {
|
|
|
- typesFactory.createProperty => [prop |
|
|
|
- (typeSystem as AbstractTypeSystem).resource.contents += prop
|
|
|
-
|
|
|
+ typesFactory.createProperty => [ prop |
|
|
|
+ builtinResource.contents += prop
|
|
|
+
|
|
|
prop.name = name
|
|
|
prop.typeSpecifier = typesFactory.createTypeSpecifier => [
|
|
|
it.type = type
|