User: ara_e_w 
  Date: 02/02/17 13:12:09

  Modified:    src/xjavadoc/binary BinaryClass.java BinaryConstructor.java
                        BinaryExecutableMember.java BinaryMethod.java
  Log:
  - more compatible with doclet api
  - modifiers scanning for top level classes
  - ....!
  
  Revision  Changes    Path
  1.5       +186 -47   xjavadoc/src/xjavadoc/binary/BinaryClass.java
  
  Index: BinaryClass.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/binary/BinaryClass.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -w -r1.4 -r1.5
  --- BinaryClass.java  18 Dec 2001 23:26:29 -0000      1.4
  +++ BinaryClass.java  17 Feb 2002 21:12:08 -0000      1.5
  @@ -1,3 +1,38 @@
  +/*
  + * Copyright (c) 2001, Aslak Helles�y, BEKK Consulting
  + * All rights reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without modification,
  + * are permitted provided that the following conditions are met:
  + *
  + * - Redistributions of source code must retain the above copyright notice,
  + *   this list of conditions and the following disclaimer.
  + *
  + * - Redistributions in binary form must reproduce the above copyright
  + *   notice, this list of conditions and the following disclaimer in the
  + *   documentation and/or other materials provided with the distribution.
  + *
  + * - Neither the name of BEKK Consulting nor the names of its
  + *   contributors may be used to endorse or promote products derived from
  + *   this software without specific prior written permission.
  + *
  + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
  + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  + * DAMAGE.
  + */
  +
  +/*
  + * Change log
  + *
  + */
   package xjavadoc.binary;
   
   import java.lang.reflect.Constructor;
  @@ -8,25 +43,66 @@
   import xjavadoc.XConstructor;
   import xjavadoc.XJavaDoc;
   import xjavadoc.XMethod;
  +import xjavadoc.ast.Token;
   
  +/**
  + * Describe what this class does
  + *
  + * @author Ara Abrahamian
  + * @created February 17, 2002
  + * @todo-javadoc Write javadocs
  + */
   public class BinaryClass extends NoSourceClass {
   
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
       private Class _class;
   
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
        private XMethod[] _methods;
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
        private XConstructor[] _constructors;
   
  -//    public static final BinaryClass OBJECT = new BinaryClass( null, Object.class 
);
  -
  -    public BinaryClass( XJavaDoc xJavaDoc, Class clazz ) {
  -             super(xJavaDoc);
   
  -             if( xJavaDoc == null ) throw new IllegalStateException( "xJavaDoc 
can't be null" );
  +//    public static final BinaryClass OBJECT = new BinaryClass( null, Object.class 
);
   
  +     /**
  +      * Describe what the BinaryClass constructor does
  +      *
  +      * @param clazz Describe what the parameter does
  +      * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for constructor
  +      * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
  +      */
  +     public BinaryClass(Class clazz) {
           _class = clazz;
           setQualifiedName( _class.getName() );
       }
   
  +
  +     /**
  +      * Gets the Abstract attribute of the BinaryClass object
  +      *
  +      * @return The Abstract value
  +      */
  +     public boolean isAbstract() {
  +             return Modifier.isAbstract(_class.getModifiers());
  +     }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
       public XClass superclass() {
           XClass result = null;
   
  @@ -34,45 +110,108 @@
           Class superClass = _class.getSuperclass();
           if( superClass != null ) {
               superClassName = superClass.getName();
  -            result = _xJavaDoc.getXClass( superClassName );
  +                     result = XJavaDoc.getInstance().getXClass(superClassName);
           }
           return result;
       }
   
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     public String modifiers() {
  +
  +             return Modifier.toString(_class.getModifiers());
  +     }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
       public XMethod[] methods() {
                if( _methods == null ) {
                        Method[] methods = _class.getDeclaredMethods();
                        _methods = new BinaryMethod[ methods.length ];
                        for( int i = 0; i < methods.length; i++ ) {
  -                             _methods[ i ] = new BinaryMethod( _xJavaDoc, this, 
methods[ i ] );
  +                             _methods[i] = new BinaryMethod(this, methods[i]);
                                //_xJavaDoc.getXClass( interfaces[ i ].getName() );
                        }
                }
           return _methods;
       }
   
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
       public XConstructor[] constructors() {
                if( _constructors == null ) {
                        Constructor[] constructors = _class.getDeclaredConstructors();
                        _constructors = new BinaryConstructor[ constructors.length ];
                        for( int i = 0; i < constructors.length; i++ ) {
  -                             _constructors[ i ] = new BinaryConstructor( _xJavaDoc, 
this, constructors[ i ] );
  +                             _constructors[i] = new BinaryConstructor(this, 
constructors[i]);
                                //_xJavaDoc.getXClass( interfaces[ i ].getName() );
                        }
                }
           return _constructors;
       }
   
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
       public XClass[] interfaces() {
           Class[] interfaces = _class.getInterfaces();
           XClass[] result = new XClass[ interfaces.length ];
           for( int i = 0; i < interfaces.length; i++ ) {
  -            result[ i ] = _xJavaDoc.getXClass( interfaces[ i ].getName() );
  +                     result[i] = 
XJavaDoc.getInstance().getXClass(interfaces[i].getName());
           }
           return result;
       }
   
  -    public boolean isAbstract() {
  -        return Modifier.isAbstract( _class.getModifiers() );
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     public String name() {
  +             int dot_index = _class.getName().lastIndexOf('.');
  +             if (dot_index == -1) {
  +                     return _class.getName();
  +             }
  +             else {
  +                     return _class.getName().substring(dot_index + 1);
  +             }
  +     }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     public String qualifiedName() {
  +             return _class.getName();
       }
   }
  
  
  
  1.3       +81 -11    xjavadoc/src/xjavadoc/binary/BinaryConstructor.java
  
  Index: BinaryConstructor.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/binary/BinaryConstructor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- BinaryConstructor.java    18 Dec 2001 23:26:29 -0000      1.2
  +++ BinaryConstructor.java    17 Feb 2002 21:12:08 -0000      1.3
  @@ -1,17 +1,90 @@
  +/*
  + * Copyright (c) 2001, Aslak Helles�y, BEKK Consulting
  + * All rights reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without modification,
  + * are permitted provided that the following conditions are met:
  + *
  + * - Redistributions of source code must retain the above copyright notice,
  + *   this list of conditions and the following disclaimer.
  + *
  + * - Redistributions in binary form must reproduce the above copyright
  + *   notice, this list of conditions and the following disclaimer in the
  + *   documentation and/or other materials provided with the distribution.
  + *
  + * - Neither the name of BEKK Consulting nor the names of its
  + *   contributors may be used to endorse or promote products derived from
  + *   this software without specific prior written permission.
  + *
  + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
  + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  + * DAMAGE.
  + */
  +
  +/*
  + * Change log
  + *
  + */
   package xjavadoc.binary;
   
   import xjavadoc.XConstructor;
   import xjavadoc.XJavaDoc;
   import java.lang.reflect.Constructor;
   
  +/**
  + * Describe what this class does
  + *
  + * @author Ara Abrahamian
  + * @created February 17, 2002
  + * @todo-javadoc Write javadocs
  + */
   class BinaryConstructor extends BinaryExecutableMember implements XConstructor {
   
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
        private String _name;
   
  -     BinaryConstructor( XJavaDoc xJavaDoc, BinaryClass containingClass, Constructor 
constructor ) {
  -             super( xJavaDoc, containingClass, constructor );
  +
  +     /**
  +      * Describe what the BinaryConstructor constructor does
  +      *
  +      * @param containingClass Describe what the parameter does
  +      * @param constructor Describe what the parameter does
  +      * @todo-javadoc Write javadocs for constructor
  +      * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
  +      */
  +     BinaryConstructor(BinaryClass containingClass, Constructor constructor) {
  +             super(containingClass, constructor);
  +     }
  +
  +
  +     /**
  +      * Gets the Constructor attribute of the BinaryConstructor object
  +      *
  +      * @return The Constructor value
  +      */
  +     public final boolean isConstructor() {
  +             return true;
        }
   
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
        public String name() {
                if( _name == null ) {
                        // the name of a java.lang.reflect.Constructor is package 
qualified. Don't want that!
  @@ -19,14 +92,11 @@
                        int lastDot = name.lastIndexOf( '.' );
                        if( lastDot != -1 ) {
                                _name = name.substring( lastDot + 1 );
  -                     } else {
  +                     }
  +                     else {
                                _name = name;
                        }
                }
                return _name;
  -     }
  -
  -     public final boolean isConstructor() {
  -             return true;
        }
   }
  
  
  
  1.4       +122 -12   xjavadoc/src/xjavadoc/binary/BinaryExecutableMember.java
  
  Index: BinaryExecutableMember.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/binary/BinaryExecutableMember.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- BinaryExecutableMember.java       11 Feb 2002 14:11:57 -0000      1.3
  +++ BinaryExecutableMember.java       17 Feb 2002 21:12:08 -0000      1.4
  @@ -39,10 +39,9 @@
   import java.lang.reflect.Constructor;
   import java.lang.reflect.Member;
   import java.lang.reflect.Method;
  -import xjavadoc.XClass;
  +
  +import xjavadoc.*;
   import xjavadoc.XDoc;
  -import xjavadoc.XExecutableMember;
  -import xjavadoc.XJavaDoc;
   import xjavadoc.XParameter;
   
   /**
  @@ -56,10 +55,6 @@
        /**
         * @todo-javadoc Describe the field
         */
  -     protected final XJavaDoc _xJavaDoc;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
        private AccessibleObject _accessibleObject;
        /**
         * @todo-javadoc Describe the field
  @@ -77,15 +72,13 @@
   
        /**
         * @todo maybe do the param and exception stuff lazily to gain performance
  -      * @param xJavaDoc Describe what the parameter does
         * @param containingClass Describe what the parameter does
         * @param accessibleObject Describe what the parameter does
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         * @todo-javadoc Write javadocs for method parameter
         */
  -     BinaryExecutableMember(XJavaDoc xJavaDoc, BinaryClass containingClass, 
AccessibleObject accessibleObject) {
  -             _xJavaDoc = xJavaDoc;
  +     BinaryExecutableMember(BinaryClass containingClass, AccessibleObject 
accessibleObject) {
                _containingClass = containingClass;
                _accessibleObject = accessibleObject;
   
  @@ -103,14 +96,84 @@
                }
                _parameters = new XParameter[parameters.length];
                for (int i = parameters.length - 1; i >= 0; i--) {
  -                     XClass xClass = _xJavaDoc.getXClass(parameters[i].getName());
  +                     XClass xClass = 
XJavaDoc.getInstance().getXClass(parameters[i].getName());
                        // TODO X
                        _parameters[i] = new BinaryParameter(xClass, "p" + i, 0);
                }
                _exceptions = new XClass[exceptions.length];
                for (int i = exceptions.length - 1; i >= 0; i--) {
  -                     _exceptions[i] = _xJavaDoc.getXClass(exceptions[i].getName());
  +                     _exceptions[i] = 
XJavaDoc.getInstance().getXClass(exceptions[i].getName());
  +             }
  +     }
  +
  +
  +     /**
  +      * Gets the Constructor attribute of the BinaryExecutableMember object
  +      *
  +      * @return The Constructor value
  +      */
  +     public boolean isConstructor() {
  +             return false;
  +     }
  +
  +
  +     /**
  +      * Gets the Final attribute of the BinaryExecutableMember object
  +      *
  +      * @return The Final value
  +      */
  +     public boolean isFinal() {
  +             return false;
  +     }
  +
  +
  +     /**
  +      * Gets the PackagePrivate attribute of the BinaryExecutableMember object
  +      *
  +      * @return The PackagePrivate value
  +      */
  +     public boolean isPackagePrivate() {
  +             return false;
  +     }
  +
  +
  +     /**
  +      * Gets the Private attribute of the BinaryExecutableMember object
  +      *
  +      * @return The Private value
  +      */
  +     public boolean isPrivate() {
  +             return false;
  +     }
  +
  +
  +     /**
  +      * Gets the Protected attribute of the BinaryExecutableMember object
  +      *
  +      * @return The Protected value
  +      */
  +     public boolean isProtected() {
  +             return false;
                }
  +
  +
  +     /**
  +      * Gets the Public attribute of the BinaryExecutableMember object
  +      *
  +      * @return The Public value
  +      */
  +     public boolean isPublic() {
  +             return false;
  +     }
  +
  +
  +     /**
  +      * Gets the Static attribute of the BinaryExecutableMember object
  +      *
  +      * @return The Static value
  +      */
  +     public boolean isStatic() {
  +             return false;
        }
   
   
  @@ -171,4 +234,51 @@
                return null;
        }
   
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     public XPackage containingPackage() {
  +             return null;
  +     }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     public String modifiers() {
  +             return null;
  +     }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     public int modifierSpecifier() {
  +             return 0;
  +     }
  +
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     public String qualifiedName() {
  +             return null;
  +     }
   }
  
  
  
  1.3       +79 -7     xjavadoc/src/xjavadoc/binary/BinaryMethod.java
  
  Index: BinaryMethod.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/binary/BinaryMethod.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- BinaryMethod.java 18 Dec 2001 23:26:29 -0000      1.2
  +++ BinaryMethod.java 17 Feb 2002 21:12:08 -0000      1.3
  @@ -1,3 +1,38 @@
  +/*
  + * Copyright (c) 2001, Aslak Helles�y, BEKK Consulting
  + * All rights reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without modification,
  + * are permitted provided that the following conditions are met:
  + *
  + * - Redistributions of source code must retain the above copyright notice,
  + *   this list of conditions and the following disclaimer.
  + *
  + * - Redistributions in binary form must reproduce the above copyright
  + *   notice, this list of conditions and the following disclaimer in the
  + *   documentation and/or other materials provided with the distribution.
  + *
  + * - Neither the name of BEKK Consulting nor the names of its
  + *   contributors may be used to endorse or promote products derived from
  + *   this software without specific prior written permission.
  + *
  + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
  + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  + * DAMAGE.
  + */
  +
  +/*
  + * Change log
  + *
  + */
   package xjavadoc.binary;
   
   import java.lang.reflect.Method;
  @@ -5,24 +40,61 @@
   import xjavadoc.XJavaDoc;
   import xjavadoc.XMethod;
   
  +/**
  + * Describe what this class does
  + *
  + * @author Ara Abrahamian
  + * @created February 17, 2002
  + * @todo-javadoc Write javadocs
  + */
   class BinaryMethod extends BinaryExecutableMember implements XMethod {
  +     /**
  +      * @todo-javadoc Describe the field
  +      */
       private Method _method;
   
  -     BinaryMethod( XJavaDoc xJavaDoc, BinaryClass containingClass, Method method ) {
  -             super( xJavaDoc, containingClass, method );
  +
  +     /**
  +      * Describe what the BinaryMethod constructor does
  +      *
  +      * @param containingClass Describe what the parameter does
  +      * @param method Describe what the parameter does
  +      * @todo-javadoc Write javadocs for constructor
  +      * @todo-javadoc Write javadocs for method parameter
  +      * @todo-javadoc Write javadocs for method parameter
  +      */
  +     BinaryMethod(BinaryClass containingClass, Method method) {
  +             super(containingClass, method);
                _method = method;
        }
   
  -    public XClass returnType() {
  -             return _xJavaDoc.getXClass( _method.getReturnType().getName() );
  -     }
   
  +     /**
  +      * Gets the Constructor attribute of the BinaryMethod object
  +      *
  +      * @return The Constructor value
  +      */
        public final boolean isConstructor() {
                return false;
        }
   
  +
  +     /**
  +      * Describe what the method does
  +      *
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for method
  +      * @todo-javadoc Write javadocs for return value
  +      */
  +     public XClass returnType() {
  +             return 
XJavaDoc.getInstance().getXClass(_method.getReturnType().getName());
  +     }
  +
  +
        /**
         * @todo fix the dimension here
  +      * @return Describe the return value
  +      * @todo-javadoc Write javadocs for return value
         */
       public final int returnDimension() {
                return 0;
  
  
  

_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to