26 package javax.lang.model.element;
27
28 import javax.lang.model.util.*;
29
30 /**
31 * A visitor of program elements, in the style of the visitor design
32 * pattern. Classes implementing this interface are used to operate
33 * on an element when the kind of element is unknown at compile time.
34 * When a visitor is passed to an element's {@link Element#accept
35 * accept} method, the <code>visit<i>Xyz</i></code> method most applicable
36 * to that element is invoked.
37 *
38 * <p> Classes implementing this interface may or may not throw a
39 * {@code NullPointerException} if the additional parameter {@code p}
40 * is {@code null}; see documentation of the implementing class for
41 * details.
42 *
43 * @apiNote
44 * <strong>WARNING:</strong> It is possible that methods will be added
45 * to this interface to accommodate new, currently unknown, language
46 * structures added to future versions of the Java™ programming
47 * language.
48 *
49 * Such additions have already occurred to support language features
50 * added after this API was introduced.
51 *
52 * Visitor classes directly implementing this interface may be source
53 * incompatible with future versions of the platform. To avoid this
54 * source incompatibility, visitor implementations are encouraged to
55 * instead extend the appropriate abstract visitor class that
56 * implements this interface. However, an API should generally use
57 * this visitor interface as the type for parameters, return type,
58 * etc. rather than one of the abstract classes.
59 *
60 * <p>Methods to accommodate new language constructs are expected to
61 * be added as default methods to provide strong source compatibility,
62 * as done for {@link visitModule visitModule}. The implementations of
63 * the default methods will in turn call {@link visitUnknown
64 * visitUnknown}, behavior that will be overridden in concrete
65 * visitors supporting the source version with the new language
66 * construct.
|
26 package javax.lang.model.element;
27
28 import javax.lang.model.util.*;
29
30 /**
31 * A visitor of program elements, in the style of the visitor design
32 * pattern. Classes implementing this interface are used to operate
33 * on an element when the kind of element is unknown at compile time.
34 * When a visitor is passed to an element's {@link Element#accept
35 * accept} method, the <code>visit<i>Xyz</i></code> method most applicable
36 * to that element is invoked.
37 *
38 * <p> Classes implementing this interface may or may not throw a
39 * {@code NullPointerException} if the additional parameter {@code p}
40 * is {@code null}; see documentation of the implementing class for
41 * details.
42 *
43 * @apiNote
44 * <strong>WARNING:</strong> It is possible that methods will be added
45 * to this interface to accommodate new, currently unknown, language
46 * structures added to future versions of the Java programming
47 * language.
48 *
49 * Such additions have already occurred to support language features
50 * added after this API was introduced.
51 *
52 * Visitor classes directly implementing this interface may be source
53 * incompatible with future versions of the platform. To avoid this
54 * source incompatibility, visitor implementations are encouraged to
55 * instead extend the appropriate abstract visitor class that
56 * implements this interface. However, an API should generally use
57 * this visitor interface as the type for parameters, return type,
58 * etc. rather than one of the abstract classes.
59 *
60 * <p>Methods to accommodate new language constructs are expected to
61 * be added as default methods to provide strong source compatibility,
62 * as done for {@link visitModule visitModule}. The implementations of
63 * the default methods will in turn call {@link visitUnknown
64 * visitUnknown}, behavior that will be overridden in concrete
65 * visitors supporting the source version with the new language
66 * construct.
|