-
- Type Parameters:
R
- the return type of this visitor's methods. UseVoid
for visitors that do not need to return results.P
- the type of the additional parameter to this visitor's methods. UseVoid
for 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'saccept
method, thevisitXyz
method applicable to that directive is invoked.Classes implementing this interface may or may not throw a
NullPointerException
if the additional parameterp
isnull
; 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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default R
visit(ModuleElement.Directive d)
Visits any directive as if by passing itself to that directive'saccept
method and passingnull
for the additional parameter.default R
visit(ModuleElement.Directive d, P p)
Visits any directive as if by passing itself to that directive'saccept
method.R
visitExports(ModuleElement.ExportsDirective d, P p)
Visits anexports
directive.R
visitOpens(ModuleElement.OpensDirective d, P p)
Visits anopens
directive.R
visitProvides(ModuleElement.ProvidesDirective d, P p)
Visits aprovides
directive.R
visitRequires(ModuleElement.RequiresDirective d, P p)
Visits arequires
directive.default R
visitUnknown(ModuleElement.Directive d, P p)
Visits an unknown directive.R
visitUses(ModuleElement.UsesDirective d, P p)
Visits auses
directive.
-
-
-
Method Detail
-
visit
default R visit(ModuleElement.Directive d)
Visits any directive as if by passing itself to that directive'saccept
method and passingnull
for 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
default R visit(ModuleElement.Directive d, P p)
Visits any directive as if by passing itself to that directive'saccept
method.- 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
R visitRequires(ModuleElement.RequiresDirective d, P p)
Visits arequires
directive.- Parameters:
d
- the directive to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitExports
R visitExports(ModuleElement.ExportsDirective d, P p)
Visits anexports
directive.- Parameters:
d
- the directive to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitOpens
R visitOpens(ModuleElement.OpensDirective d, P p)
Visits anopens
directive.- Parameters:
d
- the directive to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitUses
R visitUses(ModuleElement.UsesDirective d, P p)
Visits auses
directive.- Parameters:
d
- the directive to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitProvides
R visitProvides(ModuleElement.ProvidesDirective d, P p)
Visits aprovides
directive.- Parameters:
d
- the directive to visitp
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitUnknown
default R visitUnknown(ModuleElement.Directive d, P p)
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
-
-