Package org.zaproxy.zap.extension.api
Class AbstractAPIGenerator
- java.lang.Object
-
- org.zaproxy.zap.extension.api.AbstractAPIGenerator
-
- Direct Known Subclasses:
DotNetAPIGenerator
,GoAPIGenerator
,JavaAPIGenerator
,NodeJSAPIGenerator
,PhpAPIGenerator
,PythonAPIGenerator
,RustAPIGenerator
,WikiAPIGenerator
public abstract class AbstractAPIGenerator extends java.lang.Object
The base class for ZAP API client generators.- Since:
- 2.6.0
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
ACTION_ENDPOINT
protected static java.lang.String
OPTIONAL_MESSAGE
protected static java.lang.String
OTHER_ENDPOINT
protected static java.lang.String
VIEW_ENDPOINT
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractAPIGenerator(java.lang.String directory)
Constructs anAbstractAPIGenerator
with the given directory.protected
AbstractAPIGenerator(java.lang.String directory, boolean optional)
Constructs anAbstractAPIGenerator
with the given directory and optional state.protected
AbstractAPIGenerator(java.lang.String directory, boolean optional, java.util.ResourceBundle resourceBundle)
Constructs anAbstractAPIGenerator
with the given directory, optional state, andResourceBundle
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
generateAPIFiles(java.util.List<ApiImplementor> implementors)
Generates the API client files of the given API implementors.protected abstract void
generateAPIFiles(ApiImplementor implementor)
Generates the API client files of the given API implementor.void
generateCoreAPIFiles()
Generates the API client files for the core API implementors.protected java.nio.file.Path
getDirectory()
Gets the directory where the API client files should be generated.protected java.util.ResourceBundle
getMessages()
Gets the messages for doc of the generated classes.protected boolean
isOptional()
If the API client files being generated are optional, that is, belong to an add-on.
-
-
-
Field Detail
-
OPTIONAL_MESSAGE
protected static final java.lang.String OPTIONAL_MESSAGE
- See Also:
- Constant Field Values
-
VIEW_ENDPOINT
protected static final java.lang.String VIEW_ENDPOINT
- See Also:
- Constant Field Values
-
ACTION_ENDPOINT
protected static final java.lang.String ACTION_ENDPOINT
- See Also:
- Constant Field Values
-
OTHER_ENDPOINT
protected static final java.lang.String OTHER_ENDPOINT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractAPIGenerator
protected AbstractAPIGenerator(java.lang.String directory)
Constructs anAbstractAPIGenerator
with the given directory.- Parameters:
directory
- the directory where the API client files should be generated
-
AbstractAPIGenerator
protected AbstractAPIGenerator(java.lang.String directory, boolean optional)
Constructs anAbstractAPIGenerator
with the given directory and optional state.- Parameters:
directory
- the directory where the API client files should be generatedoptional
-true
if the API client files are optional,false
otherwise
-
AbstractAPIGenerator
protected AbstractAPIGenerator(java.lang.String directory, boolean optional, java.util.ResourceBundle resourceBundle)
Constructs anAbstractAPIGenerator
with the given directory, optional state, andResourceBundle
.- Parameters:
directory
- the directory where the API client files should be generatedoptional
-true
if the API client files are optional,false
otherwiseresourceBundle
- theResourceBundle
used for doc of the generated classes.- Since:
- 2.8.0
-
-
Method Detail
-
getDirectory
protected java.nio.file.Path getDirectory()
Gets the directory where the API client files should be generated.- Returns:
- the directory where the API client files should be generated
-
isOptional
protected boolean isOptional()
If the API client files being generated are optional, that is, belong to an add-on.- Returns:
true
if the API client files are optional,false
otherwise
-
getMessages
protected java.util.ResourceBundle getMessages()
Gets the messages for doc of the generated classes.- Returns:
- the
ResourceBundle
with the messages for doc
-
generateCoreAPIFiles
public void generateCoreAPIFiles() throws java.io.IOException
Generates the API client files for the core API implementors.- Throws:
java.io.IOException
- if an error occurred while writing the API files
-
generateAPIFiles
public void generateAPIFiles(java.util.List<ApiImplementor> implementors) throws java.io.IOException
Generates the API client files of the given API implementors.- Parameters:
implementors
- the API implementors, must not benull
- Throws:
java.io.IOException
- if an error occurred while writing the API files
-
generateAPIFiles
protected abstract void generateAPIFiles(ApiImplementor implementor) throws java.io.IOException
Generates the API client files of the given API implementor.- Parameters:
implementor
- the API implementor, must not benull
- Throws:
java.io.IOException
- if an error occurred while writing the API files
-
-