- Type Parameters:
R- the return type of this visitor's methods. UseVoidfor visitors that do not need to return results.P- the type of the additional parameter to this visitor's methods. UseVoidfor visitors that do not need an additional parameter.
- Enclosing interface:
ModuleElement
public static interface ModuleElement.DirectiveVisitor<R,P>
A visitor of module directives, in the style of the visitor design
pattern. Classes implementing this interface are used to operate
on a directive when the kind of directive is unknown at compile time.
When a visitor is passed to a directive's
accept method, the visitXyz method applicable
to that directive is invoked.
Classes implementing this interface may or may not throw a
NullPointerException if the additional parameter p
is null; see documentation of the implementing class for
details.
WARNING: It is possible that methods will be added to this interface to accommodate new, currently unknown, language structures added to future versions of the Java programming language. Methods to accommodate new language constructs will be added in a source compatible way using default methods.
- Since:
- 9
-
Method Summary
Modifier and TypeMethodDescriptiondefault RVisits any directive as if by passing itself to that directive'sacceptmethod and passingnullfor the additional parameter.default Rvisit(ModuleElement.Directive d, P p) Visits any directive as if by passing itself to that directive'sacceptmethod.Visits anexportsdirective.Visits anopensdirective.Visits aprovidesdirective.Visits arequiresdirective.default RVisits an unknown directive.Visits ausesdirective.
-
Method Details
-
visit
Visits any directive as if by passing itself to that directive'sacceptmethod and passingnullfor the additional parameter.- Implementation Requirements:
- The default implementation is
d.accept(v, null). - Parameters:
d- the directive to visit- Returns:
- a visitor-specified result
-
visit
Visits any directive as if by passing itself to that directive'sacceptmethod.- Implementation Requirements:
- The default implementation is
d.accept(v, p). - Parameters:
d- the directive to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitRequires
Visits arequiresdirective.- Parameters:
d- the directive to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitExports
Visits anexportsdirective.- Parameters:
d- the directive to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitOpens
Visits anopensdirective.- Parameters:
d- the directive to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitUses
Visits ausesdirective.- Parameters:
d- the directive to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitProvides
Visits aprovidesdirective.- Parameters:
d- the directive to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitUnknown
Visits an unknown directive. This can occur if the language evolves and new kinds of directive are added.- Implementation Requirements:
- The default implementation throws
new UnknownDirectiveException(d, p). - Parameters:
d- the directive to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
- Throws:
UnknownDirectiveException- a visitor implementation may optionally throw this exception
-