home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / Notes.jar / lotus / notes / internal / InfoPaneMethodItem.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-15  |  3.7 KB  |  122 lines

  1. package lotus.notes.internal;
  2.  
  3. import java.lang.reflect.Method;
  4. import java.lang.reflect.Modifier;
  5. import java.util.Enumeration;
  6.  
  7. class InfoPaneMethodItem extends InfoPaneMemberItem {
  8.    protected String name;
  9.    protected String longName;
  10.    protected InfoPaneVector vector;
  11.  
  12.    InfoPaneMethodItem() {
  13.    }
  14.  
  15.    InfoPaneMethodItem(Method var1, boolean var2) {
  16.       this.longName = var1.toString();
  17.       this.name = var1.getName();
  18.       this.AddParams(var1.getParameterTypes());
  19.       if (!Modifier.isPublic(var1.getDeclaringClass().getModifiers())) {
  20.          this.longName = this.name;
  21.       }
  22.  
  23.       this.vector = new InfoPaneVector();
  24.  
  25.       try {
  26.          this.AddModifiers(var1, var2);
  27.          this.AddReturnType(var1);
  28.          this.AddThrows(var1);
  29.       } catch (InfoPaneException var4) {
  30.          System.out.println("InfoPaneMethodItem constructor: " + var4);
  31.       }
  32.    }
  33.  
  34.    void AddParams(Class[] var1) {
  35.       this.name = this.name + "(";
  36.       if (var1 != null) {
  37.          try {
  38.             this.AddParam(var1[0]);
  39.  
  40.             for(int var2 = 1; var1[var2] != null; ++var2) {
  41.                this.name = this.name + ",";
  42.                this.AddParam(var1[var2]);
  43.             }
  44.          } catch (ArrayIndexOutOfBoundsException var3) {
  45.          }
  46.       }
  47.  
  48.       this.name = this.name + ")";
  49.    }
  50.  
  51.    void AddParam(Class var1) {
  52.       String var2;
  53.       for(var2 = ""; var1.isArray(); var2 = var2 + "[]") {
  54.          var1 = var1.getComponentType();
  55.       }
  56.  
  57.       this.name = this.name + InfoPaneMemberItem.StripPack(var1.getName()) + var2;
  58.    }
  59.  
  60.    void AddModifiers(Method var1, boolean var2) throws InfoPaneException {
  61.       InfoPaneMethodSubItem var3 = new InfoPaneMethodSubItem(var1.getModifiers(), var2);
  62.       if (var3.HasSubCategory()) {
  63.          this.vector.Insert(var3);
  64.       }
  65.  
  66.    }
  67.  
  68.    void AddReturnType(Method var1) throws InfoPaneException {
  69.       InfoPaneMethodSubItem var2 = new InfoPaneMethodSubItem(var1.getReturnType());
  70.       this.vector.Insert(var2);
  71.    }
  72.  
  73.    void AddThrows(Method var1) throws InfoPaneException {
  74.       InfoPaneMethodSubItem var2 = new InfoPaneMethodSubItem(var1.getExceptionTypes());
  75.       if (var2.HasSubCategory()) {
  76.          this.vector.Insert(var2);
  77.       }
  78.  
  79.    }
  80.  
  81.    public boolean HasSubCategory() {
  82.       return this.vector != null && this.vector.size() > 0;
  83.    }
  84.  
  85.    public Enumeration GetEnumeration() {
  86.       return this.vector == null ? null : this.vector.elements();
  87.    }
  88.  
  89.    public String GetName() {
  90.       return this.name;
  91.    }
  92.  
  93.    public String GetLongName() {
  94.       return this.longName;
  95.    }
  96.  
  97.    public boolean HasLongName() {
  98.       return this.longName != null && this.name != null && this.longName.length() > this.name.length();
  99.    }
  100.  
  101.    public boolean CanPaste() {
  102.       return true;
  103.    }
  104.  
  105.    public void Print(String var1, boolean var2) {
  106.       if (var2 && this.HasLongName() && this.CanPaste()) {
  107.          System.out.println(var1 + this.GetLongName());
  108.       } else {
  109.          System.out.println(var1 + this.GetName());
  110.       }
  111.  
  112.       if (this.HasSubCategory()) {
  113.          Enumeration var3 = this.GetEnumeration();
  114.  
  115.          while(var3.hasMoreElements()) {
  116.             ((InfoPaneItem)var3.nextElement()).Print(var1 + "  ", var2);
  117.          }
  118.       }
  119.  
  120.    }
  121. }
  122.