21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.source.util;
27
28 import com.sun.source.doctree.*;
29
30 /**
31 * A simple visitor for tree nodes.
32 *
33 * @param <R> the return type of this visitor's methods. Use {@link
34 * Void} for visitors that do not need to return results.
35 * @param <P> the type of the additional parameter to this visitor's
36 * methods. Use {@code Void} for visitors that do not need an
37 * additional parameter.
38 *
39 * @since 1.8
40 */
41 @jdk.Exported
42 public class SimpleDocTreeVisitor<R,P> implements DocTreeVisitor<R, P> {
43 /**
44 * The default value, returned by the {@link #defaultAction default action}.
45 */
46 protected final R DEFAULT_VALUE;
47
48 /**
49 * Creates a visitor, with a DEFAULT_VALUE of {@code null}.
50 */
51 protected SimpleDocTreeVisitor() {
52 DEFAULT_VALUE = null;
53 }
54
55 /**
56 * Creates a visitor, with a specified DEFAULT_VALUE.
57 * @param defaultValue the default value to be returned by the default action.
58 */
59 protected SimpleDocTreeVisitor(R defaultValue) {
60 DEFAULT_VALUE = defaultValue;
61 }
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.source.util;
27
28 import com.sun.source.doctree.*;
29
30 /**
31 * A simple visitor for tree nodes.
32 *
33 * @param <R> the return type of this visitor's methods. Use {@link
34 * Void} for visitors that do not need to return results.
35 * @param <P> the type of the additional parameter to this visitor's
36 * methods. Use {@code Void} for visitors that do not need an
37 * additional parameter.
38 *
39 * @since 1.8
40 */
41 public class SimpleDocTreeVisitor<R,P> implements DocTreeVisitor<R, P> {
42 /**
43 * The default value, returned by the {@link #defaultAction default action}.
44 */
45 protected final R DEFAULT_VALUE;
46
47 /**
48 * Creates a visitor, with a DEFAULT_VALUE of {@code null}.
49 */
50 protected SimpleDocTreeVisitor() {
51 DEFAULT_VALUE = null;
52 }
53
54 /**
55 * Creates a visitor, with a specified DEFAULT_VALUE.
56 * @param defaultValue the default value to be returned by the default action.
57 */
58 protected SimpleDocTreeVisitor(R defaultValue) {
59 DEFAULT_VALUE = defaultValue;
60 }
|