1 package org.apache.beehive.controls.runtime.generator; 2 19 20 import java.util.ArrayList ; 21 22 26 public class ImplInitializer 27 { 28 32 protected ImplInitializer(AptControlImplementation controlImpl) 33 { 34 super(); 35 _controlImpl = controlImpl; 36 _controlIntf = _controlImpl.getControlInterface(); 37 if (_controlImpl != null) 38 { 39 _packageName = _controlImpl.getPackage(); 40 _shortName = _controlImpl.getShortName() + "Initializer"; 41 _className = _packageName + "." + _shortName; 42 if (_controlImpl.getSuperClass() != null) 43 _superClass = new ImplInitializer(_controlImpl.getSuperClass()); 44 } 45 else 46 { 47 Class c = org.apache.beehive.controls.runtime.bean.ImplInitializer.class; 48 _packageName = c.getPackage().getName(); 49 _className = c.getName(); 50 _shortName = _className.substring(_packageName.length() + 1); 51 } 52 53 _reflectFields = new ArrayList <AptField>(); 57 for (AptField genField : _controlImpl.getContexts()) 58 if (needsReflection(genField)) 59 _reflectFields.add(genField); 60 for (AptField genField : _controlImpl.getClients()) 61 if (needsReflection(genField)) 62 _reflectFields.add(genField); 63 } 64 65 68 public String getPackage() { return _packageName; } 69 70 73 public String getShortName() { return _shortName; } 74 75 78 public String getClassName() { return _className; } 79 80 83 public String getClientInitializerName() 84 { 85 return _controlImpl.getClassName() + "ClientInitializer"; 86 } 87 88 91 public AptControlImplementation getControlImplementation() { return _controlImpl; } 92 93 96 public AptControlInterface getControlInterface() { return _controlIntf; } 97 98 101 public ImplInitializer getSuperClass() { return _superClass; } 102 103 106 public boolean hasSuperClass() { return _superClass != null; } 107 108 112 static public boolean needsReflection(AptField genField) 113 { 114 String accessModifier = genField.getAccessModifier(); 119 if (accessModifier.equals("private")) 120 return true; 121 122 return false; 123 } 124 125 128 public ArrayList <AptField> getReflectFields() 129 { 130 return _reflectFields; 131 } 132 133 String _packageName; 134 String _shortName; 135 String _className; 136 AptControlImplementation _controlImpl; 137 AptControlInterface _controlIntf; 138 ImplInitializer _superClass; 139 ArrayList <AptField> _reflectFields; 140 } 141 | Popular Tags |