-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathExtension.java
79 lines (70 loc) · 2.52 KB
/
Extension.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package zserio.tools;
import org.apache.commons.cli.Options;
import zserio.ast.Root;
import zserio.extension.common.ZserioExtensionException;
/**
* The basic interface for all Zserio extensions.
*/
public interface Extension
{
/**
* Gets name of the extension.
*
* @return Name of this extension.
*/
public String getName();
/**
* Returns the version of Zserio core which is expected by the extension.
*
* Zserio core checks if the current version can satisfy the extension
* (i.e. if the AST and common interfaces are compatible).
*
* @return Version string of Zserio core which is expected by the extension.
*/
public String getZserioVersion();
/**
* Returns the version of Zserio extension.
*
* @return Version string of Zserio extension.
*/
public String getExtensionVersion();
/**
* Registers all command line options that extension accepts.
*
* @param options Instance where the options should be registered.
*/
public void registerOptions(Options options);
/**
* Calls to check if the extension is enabled or not.
*
* @param parameters The parameters to pass to extension.
*
* @return true if the extension is enabled, otherwise false.
*/
public boolean isEnabled(ExtensionParameters parameters);
/**
* Calls the extension to check Zserio tree.
*
* Extension does its basic checks on Zserio AST. Extensions which generate code should verify that
* it will be possible to generate the given schema correctly (e.g. checks reserved keywords, etc.).
*
* The caller (i.e. Zserio core) is responsible for calling the check() phase before process().
*
* @param rootNode The root node of Zserio tree to check.
* @param parameters The parameters to pass to extension.
*
* @throws ZserioExtensionException In case of any error in extension.
*/
public void check(Root rootNode, ExtensionParameters parameters) throws ZserioExtensionException;
/**
* Calls the extension to process Zserio tree.
*
* The caller (i.e. Zserio core) is responsible for calling the check() phase before process().
*
* @param rootNode The root node of Zserio tree to process.
* @param parameters The parameters to pass to extension.
*
* @throws ZserioExtensionException In case of any error in extension.
*/
public void process(Root rootNode, ExtensionParameters parameters) throws ZserioExtensionException;
}