src/share/classes/com/sun/mirror/util/SourceOrderDeclScanner.java

Print this page




  25 
  26 package com.sun.mirror.util;
  27 
  28 import com.sun.mirror.declaration.*;
  29 
  30 import java.util.SortedSet;
  31 import java.util.TreeSet;
  32 
  33 /**
  34  * A visitor for declarations that scans declarations contained within
  35  * the given declaration in source code order.  For example, when
  36  * visiting a class, the methods, fields, constructors, and nested
  37  * types of the class are also visited.
  38  *
  39  * To control the processing done on a declaration, users of this
  40  * class pass in their own visitors for pre and post processing.  The
  41  * preprocessing visitor is called before the contained declarations
  42  * are scanned; the postprocessing visitor is called after the
  43  * contained declarations are scanned.
  44  *





  45  * @author Joseph D. Darcy
  46  * @author Scott Seligman
  47  * @since 1.5
  48  */


  49 class SourceOrderDeclScanner extends DeclarationScanner {
  50     static class SourceOrderComparator implements java.util.Comparator<Declaration> {
  51         SourceOrderComparator(){}
  52 
  53 
  54         static boolean equals(Declaration d1, Declaration d2) {
  55             return d1 == d2 || (d1 != null && d1.equals(d2));
  56         }
  57 
  58         private static class DeclPartialOrder extends com.sun.mirror.util.SimpleDeclarationVisitor {
  59             private int value = 1000;
  60             private static int staticAdjust(Declaration d) {
  61                 return d.getModifiers().contains(Modifier.STATIC)?0:1;
  62             }
  63 
  64             DeclPartialOrder() {}
  65 
  66             public int getValue() { return value; }
  67 
  68             @Override




  25 
  26 package com.sun.mirror.util;
  27 
  28 import com.sun.mirror.declaration.*;
  29 
  30 import java.util.SortedSet;
  31 import java.util.TreeSet;
  32 
  33 /**
  34  * A visitor for declarations that scans declarations contained within
  35  * the given declaration in source code order.  For example, when
  36  * visiting a class, the methods, fields, constructors, and nested
  37  * types of the class are also visited.
  38  *
  39  * To control the processing done on a declaration, users of this
  40  * class pass in their own visitors for pre and post processing.  The
  41  * preprocessing visitor is called before the contained declarations
  42  * are scanned; the postprocessing visitor is called after the
  43  * contained declarations are scanned.
  44  *
  45  * @deprecated All components of this API have been superseded by the
  46  * standardized annotation processing API.  The replacement for the
  47  * functionality of this class is {@link
  48  * javax.lang.model.util.SimpleElementVisitor6}.
  49  *
  50  * @author Joseph D. Darcy
  51  * @author Scott Seligman
  52  * @since 1.5
  53  */
  54 @Deprecated
  55 @SuppressWarnings("deprecation")
  56 class SourceOrderDeclScanner extends DeclarationScanner {
  57     static class SourceOrderComparator implements java.util.Comparator<Declaration> {
  58         SourceOrderComparator(){}
  59 
  60 
  61         static boolean equals(Declaration d1, Declaration d2) {
  62             return d1 == d2 || (d1 != null && d1.equals(d2));
  63         }
  64 
  65         private static class DeclPartialOrder extends com.sun.mirror.util.SimpleDeclarationVisitor {
  66             private int value = 1000;
  67             private static int staticAdjust(Declaration d) {
  68                 return d.getModifiers().contains(Modifier.STATIC)?0:1;
  69             }
  70 
  71             DeclPartialOrder() {}
  72 
  73             public int getValue() { return value; }
  74 
  75             @Override