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

Print this page




  52  * <blockquote><pre>
  53  *     result = FILTER_PUBLIC.filter(decls);            </pre></blockquote>
  54  * Selecting class declarations (including enums):
  55  * <blockquote><pre>
  56  *     classFilter = DeclarationFilter.getFilter(ClassDeclaration.class);
  57  *     result = classFilter.filter(decls);              </pre></blockquote>
  58  * Selecting class declarations but excluding enums:
  59  * <blockquote><pre>
  60  *     enumFilter = DeclarationFilter.getFilter(EnumDeclaration.class);
  61  *     compoundFilter = classFilter.and(enumFilter.not());
  62  *     result = compoundFilter.filter(decls);           </pre></blockquote>
  63  * Selecting declarations named "Bob":
  64  * <blockquote><pre>
  65  *     nameFilter = new DeclarationFilter() {
  66  *                      public boolean matches(Declaration d) {
  67  *                          return d.getSimpleName().equals("Bob");
  68  *                      }
  69  *                  };
  70  *     result = nameFilter.filter(decls);               </pre></blockquote>
  71  *





  72  * @author Joseph D. Darcy
  73  * @author Scott Seligman
  74  * @since 1.5
  75  */
  76 

  77 public class DeclarationFilter {
  78 
  79     // Predefined filters for convenience.
  80 
  81     /**
  82      * A filter that selects only <tt>public</tt> declarations.
  83      */
  84     public static final DeclarationFilter FILTER_PUBLIC =
  85             new AccessFilter(PUBLIC);
  86 
  87     /**
  88      * A filter that selects only <tt>protected</tt> declarations.
  89      */
  90     public static final DeclarationFilter FILTER_PROTECTED =
  91             new AccessFilter(PROTECTED);
  92 
  93     /**
  94      * A filter that selects only <tt>public</tt> or <tt>protected</tt>
  95      * declarations.
  96      */




  52  * <blockquote><pre>
  53  *     result = FILTER_PUBLIC.filter(decls);            </pre></blockquote>
  54  * Selecting class declarations (including enums):
  55  * <blockquote><pre>
  56  *     classFilter = DeclarationFilter.getFilter(ClassDeclaration.class);
  57  *     result = classFilter.filter(decls);              </pre></blockquote>
  58  * Selecting class declarations but excluding enums:
  59  * <blockquote><pre>
  60  *     enumFilter = DeclarationFilter.getFilter(EnumDeclaration.class);
  61  *     compoundFilter = classFilter.and(enumFilter.not());
  62  *     result = compoundFilter.filter(decls);           </pre></blockquote>
  63  * Selecting declarations named "Bob":
  64  * <blockquote><pre>
  65  *     nameFilter = new DeclarationFilter() {
  66  *                      public boolean matches(Declaration d) {
  67  *                          return d.getSimpleName().equals("Bob");
  68  *                      }
  69  *                  };
  70  *     result = nameFilter.filter(decls);               </pre></blockquote>
  71  *
  72  * @deprecated All components of this API have been superseded by the
  73  * standardized annotation processing API.  The replacement for the
  74  * functionality of this class is {@link
  75  * javax.lang.model.util.ElementFilter}.
  76  *
  77  * @author Joseph D. Darcy
  78  * @author Scott Seligman
  79  * @since 1.5
  80  */
  81 @Deprecated
  82 @SuppressWarnings("deprecation")
  83 public class DeclarationFilter {
  84 
  85     // Predefined filters for convenience.
  86 
  87     /**
  88      * A filter that selects only <tt>public</tt> declarations.
  89      */
  90     public static final DeclarationFilter FILTER_PUBLIC =
  91             new AccessFilter(PUBLIC);
  92 
  93     /**
  94      * A filter that selects only <tt>protected</tt> declarations.
  95      */
  96     public static final DeclarationFilter FILTER_PROTECTED =
  97             new AccessFilter(PROTECTED);
  98 
  99     /**
 100      * A filter that selects only <tt>public</tt> or <tt>protected</tt>
 101      * declarations.
 102      */