Package org.mybatis.generator.internal
Class DefaultShellCallback
java.lang.Object
org.mybatis.generator.internal.DefaultShellCallback
- All Implemented Interfaces:
ShellCallback
-
Constructor Summary
-
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.boolean
Return 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, wait
Methods inherited from interface org.mybatis.generator.api.ShellCallback
isMergeSupported, mergeJavaFile, refreshProject
-
Constructor Details
-
DefaultShellCallback
public DefaultShellCallback(boolean overwrite)
-
-
Method Details
-
getDirectory
Description copied from interface:ShellCallback
This 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.File
object:- 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:
getDirectory
in 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:ShellCallback
Return true if the generator should overwrite an existing file if one exists. This method will be called only ifisMergeSupported()
returnsfalse
and 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:
isOverwriteEnabled
in interfaceShellCallback
- Returns:
- true if you want to overwrite existing files
-