1 20 package org.objectweb.modfact.jmi.impl.tayloredBased; 21 22 import org.objectweb.modfact.jmi.helper.*; 23 import org.objectweb.modfact.jmi.logging.ModFactLogger; 24 25 import javax.jmi.model.*; 26 27 31 public class InstanceImplementationGenerator extends CommonImplementationGenerator { 32 MofClass[] input; 33 34 ModFactLogger logger; 35 36 39 public void setInput(ModelElement[] elt) { 40 input = new MofClass[elt.length]; 41 for (int i = 0; i < input.length; i++) { 42 input[i] = (MofClass) elt[i]; 43 } 44 } 45 46 49 public void setLogger(ModFactLogger log) { 50 logger = log; 51 } 52 53 56 public void generate() { 57 58 MofClass c = input[0]; 59 60 out.println("package " +ImplHelper.implPrefix + JMIProvider.shortQualifierOf(c) + ";" ); 61 out.println("import " + JMIProvider.qualifierOf(c) + ".*;" ); 62 63 out.println("import org.objectweb.modfact.jmi.reflect.*;"); 64 65 out.print("public class " + JMIProvider.jmiClassName(c) +"Impl" 66 +" extends RefObjectImpl " 67 +"implements " 68 +JMIProvider.jmiClassQualifiedName(c) 69 +" {" ); 70 71 72 78 Attribute[] attributes_nd = 79 MofHelper.attributesOfClass( 80 c, 81 ScopeKindEnum.forName("instance_level"), true); 82 83 for (int i = 0; i < attributes_nd.length; i++) { 84 attributeTemplate(attributes_nd[i]); 85 } 86 87 Reference[] references = MofHelper.referencesOfClass( c, true ); 89 for (int i = 0; i < references.length; i++) { 90 referenceTemplate(references[i]); 91 } 92 93 Operation[] operations = MofHelper.operationsOfClass(c, ScopeKindEnum.INSTANCE_LEVEL, true ); 95 for (int i = 0; i < operations.length; i++) { 96 if (operations[i].getVisibility().equals(VisibilityKindEnum.PUBLIC_VIS)) 97 operationTemplate(operations[i]); 98 } 99 100 out.println("}"); out.flush(); 103 } 104 } 105 | Popular Tags |