public class DataModelGenerator extends Object
ODataToVdmGenerator, gathering all relevant parameter or providing default values for
unspecified ones.| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_ANNOTATION_STRATEGY
The default fully-qualified name of the class to use for providing generated Java classes with necessary
annotations.
|
static String |
DEFAULT_BASE_PATH
The default base path, used in absence of a swagger file to determine a service path.
|
static Boolean |
DEFAULT_DELETE_OUTPUT_DIRECTORY
The default flag indicating whether the output directory should be deleted prior to the generation.
|
static String |
DEFAULT_INPUT_DIRECTORY_NAME
The default directory name to search and save configuration data in.
|
static DefaultNamingStrategy.NameSource |
DEFAULT_NAMING_SOURCE
The default naming source used in the
DefaultNamingStrategy. |
static String |
DEFAULT_NAMING_STRATEGY
The default fully-qualified name of the class to use for converting names from the OData world to the Java world.
|
static String |
DEFAULT_OUTPUT_DIRECTORY_NAME
The default directory name to store the generated sources in.
|
static Boolean |
DEFAULT_OVERWRITE_FILES
The default flag indicating whether already existing files should be overwritten.
|
static String |
DEFAULT_PACKAGE_NAME
The default package prefix of the generated sources.
|
static Boolean |
DEFAULT_POJOS_ONLY
The default flag indicating whether to generate just the POJO classes (entities and complex types).
|
static String |
DEFAULT_SERVICE_NAME_MAPPING_FILE_NAME
The default file name to the name mapping properties file.
|
| Constructor and Description |
|---|
DataModelGenerator() |
| Modifier and Type | Method and Description |
|---|---|
DataModelGenerator |
deleteOutputDirectory()
Deletes the output directory specified by
withPackageName(String) prior to generating the sources. |
DataModelGenerator |
deleteOutputDirectory(boolean deleteOutputDirectory)
Defines whether to delete the output directory specified by
withPackageName(String) prior to generating
the sources. |
void |
execute()
Executes the actual generator based on the given parameter or, in case of absence, their default values.
|
DataModelGenerator |
overwriteFiles()
Defines that already existing files will get overwritten.
|
DataModelGenerator |
overwriteFiles(boolean overwriteFiles)
Defines whether already existing files will get overwritten.
|
DataModelGenerator |
pojosOnly()
Activates POJO only generation, so just entity and complex type classes are generated.
|
DataModelGenerator |
pojosOnly(boolean pojosOnly)
Defines whether to generate just the POJO classes (entities and complex types).
|
DataModelGenerator |
withAnnotationStrategy(AnnotationStrategy annotationStrategy)
Sets the class to use to provide generated Java classes with necessary annotations.
|
DataModelGenerator |
withAnnotationStrategy(String annotationStrategyClassName)
Sets the class to use to provide generated Java classes with necessary annotations.
|
DataModelGenerator |
withDefaultBasePath(String defaultBasePath)
Specifies the default base path.
|
DataModelGenerator |
withInputDirectory(File inputDirectory)
Input directory that contains the service definition files.
|
DataModelGenerator |
withInputDirectory(String inputDirectory)
Path to the input directory that contains the service definition files.
|
DataModelGenerator |
withNameSource(DefaultNamingStrategy.NameSource nameSource)
Getter for the given
DefaultNamingStrategy.NameSource. |
DataModelGenerator |
withNamingStrategy(NamingStrategy namingStrategy)
Sets the class to use to convert OData names into suitable Java names.
|
DataModelGenerator |
withNamingStrategy(String namingStrategyClassName)
Sets the class to use to convert OData names into suitable Java names.
|
DataModelGenerator |
withOutputDirectory(File outputDirectory)
Output directory to store the generated sources in.
|
DataModelGenerator |
withOutputDirectory(String outputDirectory)
Path to the output directory to store the generated sources in.
|
DataModelGenerator |
withPackageName(String packageName)
Specifies the package prefix to be used in the generated sources.
|
DataModelGenerator |
withServiceNameMapping(File serviceNameMappingFile)
The properties file containing the service name mapping.
|
DataModelGenerator |
withServiceNameMapping(String serviceNameMappingFile)
The path to the properties file containing the service name mapping.
|
public static final String DEFAULT_INPUT_DIRECTORY_NAME
public static final String DEFAULT_OUTPUT_DIRECTORY_NAME
public static final Boolean DEFAULT_DELETE_OUTPUT_DIRECTORY
public static final Boolean DEFAULT_OVERWRITE_FILES
false, an exception
is thrown if a file already exists.public static final String DEFAULT_PACKAGE_NAME
public static final String DEFAULT_BASE_PATH
public static final String DEFAULT_SERVICE_NAME_MAPPING_FILE_NAME
public static final String DEFAULT_NAMING_STRATEGY
public static final String DEFAULT_ANNOTATION_STRATEGY
public static final DefaultNamingStrategy.NameSource DEFAULT_NAMING_SOURCE
DefaultNamingStrategy.public static final Boolean DEFAULT_POJOS_ONLY
@NonNull public DataModelGenerator withInputDirectory(@NonNull String inputDirectory)
inputDirectory - The directory to read the service data from.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator withInputDirectory(@NonNull File inputDirectory)
inputDirectory - The directory to read the service data from.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator withOutputDirectory(@NonNull String outputDirectory)
The generated sources will be stored under this directory according to the packages specified.
outputDirectory - The path to the root directory to store the generated sources in.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator withOutputDirectory(@NonNull File outputDirectory)
The generated sources will be stored under this directory according to the packages specified.
outputDirectory - The root directory to store the generated sources in.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator deleteOutputDirectory()
withPackageName(String) prior to generating the sources.
This option should be used to determine the whole change set, including deleted files.
DataModelGenerator for chained method calls.@NonNull public DataModelGenerator deleteOutputDirectory(boolean deleteOutputDirectory)
withPackageName(String) prior to generating
the sources.
This option should be used to determine the whole change set, including deleted files.
deleteOutputDirectory - Flag indicating whether the output directory should be cleaned.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator overwriteFiles()
DataModelGenerator for chained method calls.@NonNull public DataModelGenerator overwriteFiles(boolean overwriteFiles)
false, an exception is thrown if a file
already exists.overwriteFiles - Flag indicating whether already existing files can be overwritten.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator withPackageName(@NonNull String packageName)
packageName - The package prefix for the generated sources.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator withDefaultBasePath(@Nullable String defaultBasePath)
If no swagger file is given, this base path, together with the metadata file name, constitute the service path with the following pattern: <defaultBasePath> + <metadataFileNameWithoutExtension>.
defaultBasePath - The default base path.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator withServiceNameMapping(@NonNull File serviceNameMappingFile)
Any service not mapped in this file will get created/updated.
serviceNameMappingFile - The file to read/set the service name mappings in.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator withServiceNameMapping(@NonNull String serviceNameMappingFile)
Any service not mapped in this file will get created/updated.
serviceNameMappingFile - The file to read/set the service name mappings in.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator withNamingStrategy(@NonNull NamingStrategy namingStrategy)
namingStrategy - Instance of a class, which must either implement the CodeNamingStrategy
interface, or extend a class which implements this interface.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator withNamingStrategy(@NonNull String namingStrategyClassName)
namingStrategyClassName - Fully-qualified name of a class, which must either implement the NamingStrategy
interface, or extend a class which implements this interface.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator withNameSource(@NonNull DefaultNamingStrategy.NameSource nameSource)
DefaultNamingStrategy.NameSource.
If the namingStrategy is DefaultNamingStrategy, this enum will be used to determine the actual
source of the java name.
nameSource - The NameSource to be used by the DefaulNamingStrategy.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator withAnnotationStrategy(@NonNull AnnotationStrategy annotationStrategy)
annotationStrategy - Instance of a class, which must either implement the AnnotationStrategy
interface, or extend a class which implements this interface.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator withAnnotationStrategy(@NonNull String annotationStrategyClassName)
annotationStrategyClassName - Fully-qualified name of a class, which must either implement the AnnotationStrategy interface, or extend a class which implements this interface.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator pojosOnly(boolean pojosOnly)
pojosOnly - Flag indicating whether to generate just the POJO classes.DataModelGenerator for chained method calls.@NonNull public DataModelGenerator pojosOnly()
DataModelGenerator for chained method calls.public void execute()
Copyright © 2018 SAP SE. All rights reserved.