1 package org.apache.beehive.controls.runtime.generator; 2 19 20 import com.sun.mirror.type.InterfaceType; 21 22 27 public class ControlBean 28 { 29 33 protected ControlBean(AptControlInterface controlIntf) 34 { 35 super(); 36 _controlIntf = controlIntf; 37 if (_controlIntf != null) 38 { 39 _packageName = _controlIntf.getPackage(); 40 _shortName = _controlIntf.getShortName() + "Bean"; 41 _className = _packageName + "." + _shortName; 42 _superClass = new ControlBean(_controlIntf.getSuperClass()); 43 } 44 else 45 { 46 Class c = org.apache.beehive.controls.runtime.bean.ControlBean.class; 47 _packageName = c.getPackage().getName(); 48 _className = c.getName(); 49 _shortName = _className.substring(_packageName.length() + 1); 50 } 51 } 52 53 56 public String getPackage() { return _packageName; } 57 58 61 public String getShortName() { return _shortName; } 62 63 66 public String getClassName() { return _className; } 67 68 71 public String getClassDeclaration() 72 { 73 StringBuffer sb = new StringBuffer (_shortName); 74 sb.append(_controlIntf.getFormalTypeParameters()); 75 return sb.toString(); 76 } 77 78 83 public String getBeanInfoName() { return _className + "BeanInfo"; } 84 85 86 89 public String getManifestName() { return _className.replace('.','/') + ".class"; } 90 91 94 public AptControlInterface getControlInterface() { return _controlIntf; } 95 96 99 public ControlBean getSuperClass() { return _superClass; } 100 101 105 public String getSuperTypeBinding() 106 { 107 InterfaceType superType = _controlIntf.getSuperType(); 108 if (superType != null) 109 { 110 String typeStr = superType.toString(); 111 int paramIndex = typeStr.indexOf('<'); 112 if (paramIndex > 0) 113 return typeStr.substring(paramIndex); 114 } 115 return ""; 116 } 117 118 String _packageName; 119 String _shortName; 120 String _className; 121 AptControlInterface _controlIntf; 122 ControlBean _superClass; 123 } 124 | Popular Tags |