Package org.mybatis.generator.internal
Class DefaultShellCallback
java.lang.Object
org.mybatis.generator.internal.DefaultShellCallback
- All Implemented Interfaces:
ShellCallback
- Direct Known Subclasses:
MavenShellCallback
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDirectory(String targetProject, String targetPackage) This method is called to ask the shell to resolve a project/package combination into a directory on the file system.booleanReturn true if the generator should overwrite an existing file if one exists.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.mybatis.generator.api.ShellCallback
isMergeSupported, mergeJavaFile, refreshProject
-
Field Details
-
overwrite
private final boolean overwrite
-
-
Constructor Details
-
DefaultShellCallback
public DefaultShellCallback(boolean overwrite)
-
-
Method Details
-
getDirectory
Description copied from interface:ShellCallbackThis method is called to ask the shell to resolve a project/package combination into a directory on the file system. This method is called repeatedly (once for each generated file), so it would be wise for an implementing class to cache results.The returned
java.io.Fileobject:- Must be a directory
- Must exist
The default shell callback interprets both values as directories and simply concatenates the two values to generate the default directory.
- Specified by:
getDirectoryin interfaceShellCallback- Parameters:
targetProject- the target projecttargetPackage- the target package- Returns:
- the directory (must exist)
- Throws:
ShellException- if the project/package cannot be resolved into a directory on the file system. In this case, the generator will not save the file it is currently working on. The generator will add the exception message to the list of warnings automatically.
-
isOverwriteEnabled
public boolean isOverwriteEnabled()Description copied from interface:ShellCallbackReturn true if the generator should overwrite an existing file if one exists. This method will be called only ifisMergeSupported()returnsfalseand a file exists that would be overwritten by a generated file. If you returntrue, then we will log a warning specifying what file was overwritten.- Specified by:
isOverwriteEnabledin interfaceShellCallback- Returns:
- true if you want to overwrite existing files
-