src/share/classes/javax/lang/model/util/ElementScanner6.java

Print this page




  93  * @since 1.6
  94  */
  95 @SupportedSourceVersion(RELEASE_6)
  96 public class ElementScanner6<R, P> extends AbstractElementVisitor6<R, P> {
  97     /**
  98      * The specified default value.
  99      */
 100     protected final R DEFAULT_VALUE;
 101 
 102     /**
 103      * Constructor for concrete subclasses; uses {@code null} for the
 104      * default value.
 105      */
 106     protected ElementScanner6(){
 107         DEFAULT_VALUE = null;
 108     }
 109 
 110     /**
 111      * Constructor for concrete subclasses; uses the argument for the
 112      * default value.


 113      */
 114     protected ElementScanner6(R defaultValue){
 115         DEFAULT_VALUE = defaultValue;
 116     }
 117 
 118     /**
 119      * Iterates over the given elements and calls {@link
 120      * #scan(Element, Object) scan(Element, P)} on each one.  Returns
 121      * the result of the last call to {@code scan} or {@code
 122      * DEFAULT_VALUE} for an empty iterable.
 123      *
 124      * @param iterable the elements to scan
 125      * @param  p additional parameter
 126      * @return the scan of the last element or {@code DEFAULT_VALUE} if no elements
 127      */
 128     public final R scan(Iterable<? extends Element> iterable, P p) {
 129         R result = DEFAULT_VALUE;
 130         for(Element e : iterable)
 131             result = scan(e, p);
 132         return result;




  93  * @since 1.6
  94  */
  95 @SupportedSourceVersion(RELEASE_6)
  96 public class ElementScanner6<R, P> extends AbstractElementVisitor6<R, P> {
  97     /**
  98      * The specified default value.
  99      */
 100     protected final R DEFAULT_VALUE;
 101 
 102     /**
 103      * Constructor for concrete subclasses; uses {@code null} for the
 104      * default value.
 105      */
 106     protected ElementScanner6(){
 107         DEFAULT_VALUE = null;
 108     }
 109 
 110     /**
 111      * Constructor for concrete subclasses; uses the argument for the
 112      * default value.
 113      *
 114      * @param defaultValue the default value
 115      */
 116     protected ElementScanner6(R defaultValue){
 117         DEFAULT_VALUE = defaultValue;
 118     }
 119 
 120     /**
 121      * Iterates over the given elements and calls {@link
 122      * #scan(Element, Object) scan(Element, P)} on each one.  Returns
 123      * the result of the last call to {@code scan} or {@code
 124      * DEFAULT_VALUE} for an empty iterable.
 125      *
 126      * @param iterable the elements to scan
 127      * @param  p additional parameter
 128      * @return the scan of the last element or {@code DEFAULT_VALUE} if no elements
 129      */
 130     public final R scan(Iterable<? extends Element> iterable, P p) {
 131         R result = DEFAULT_VALUE;
 132         for(Element e : iterable)
 133             result = scan(e, p);
 134         return result;