Skip to content

Remove implementationPackage attribute from javaClientConfiguration #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -647,25 +647,6 @@ public String getCountByExampleStatementId() {
.get(InternalAttribute.ATTR_COUNT_BY_EXAMPLE_STATEMENT_ID);
}

protected String calculateJavaClientImplementationPackage() {
JavaClientGeneratorConfiguration config = context
.getJavaClientGeneratorConfiguration();
if (config == null) {
return null;
}

StringBuilder sb = new StringBuilder();
if (stringHasValue(config.getImplementationPackage())) {
sb.append(config.getImplementationPackage());
} else {
sb.append(config.getTargetPackage());
}

sb.append(fullyQualifiedTable.getSubPackageForClientOrSqlMap(isSubPackagesEnabled(config)));

return sb.toString();
}

private boolean isSubPackagesEnabled(PropertyHolder propertyHolder) {
return isTrue(propertyHolder.getProperty(PropertyRegistry.ANY_ENABLE_SUB_PACKAGES));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2006-2018 the original author or authors.
* Copyright 2006-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,6 @@

public class JavaClientGeneratorConfiguration extends TypedPropertyHolder {
private String targetPackage;
private String implementationPackage;
private String targetProject;

public JavaClientGeneratorConfiguration() {
Expand All @@ -45,14 +44,6 @@ public void setTargetPackage(String targetPackage) {
this.targetPackage = targetPackage;
}

public String getImplementationPackage() {
return implementationPackage;
}

public void setImplementationPackage(String implementationPackage) {
this.implementationPackage = implementationPackage;
}

public void validate(List<String> errors, String contextId) {
if (!stringHasValue(targetProject)) {
errors.add(getString("ValidationError.2", contextId)); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,14 +615,10 @@ private void parseJavaClientGenerator(Context context, Node node) {
String type = attributes.getProperty("type"); //$NON-NLS-1$
String targetPackage = attributes.getProperty("targetPackage"); //$NON-NLS-1$
String targetProject = attributes.getProperty("targetProject"); //$NON-NLS-1$
String implementationPackage = attributes
.getProperty("implementationPackage"); //$NON-NLS-1$

javaClientGeneratorConfiguration.setConfigurationType(type);
javaClientGeneratorConfiguration.setTargetPackage(targetPackage);
javaClientGeneratorConfiguration.setTargetProject(targetProject);
javaClientGeneratorConfiguration
.setImplementationPackage(implementationPackage);

NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright 2006-2018 the original author or authors.
Copyright 2006-2019 the original author or authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -143,8 +143,7 @@
<!ATTLIST javaClientGenerator
type CDATA #REQUIRED
targetPackage CDATA #REQUIRED
targetProject CDATA #REQUIRED
implementationPackage CDATA #IMPLIED>
targetProject CDATA #REQUIRED>

<!--
The table element is used to specify a database table that will be the source information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,26 +121,6 @@ specify this element, then MyBatis Generator (MBG) will not generate Java client
</tr>
</table>

<h2>Optional Attributes</h2>
<table border="1" cellspacing="0" cellpadding="5">
<tr>
<th>Attribute</th>
<th>Description</th>
</tr>
<tr>
<td valign="top">implementationPackage</td>
<td>If specified, implementation classes will be placed in this package.
In the default generators, the property "enableSubPackages"
controls how the actual package is calculated. If true,
then the calculated package will be the implementationPackage plus
sub packages for the table's catalog and schema if they exist.
If "enableSubPackages" is false (the default) then the calculated package will be
exactly what is specified in the implementationPackage attribute.
MBG will create folders as required for the generated
packages.</td>
</tr>
</table>

<h2>Child Elements</h2>
<ul>
<li><a href="property.html">&lt;property&gt;</a> (0..N)</li>
Expand Down
2 changes: 2 additions & 0 deletions core/mybatis-generator-core/src/site/xhtml/whatsNew.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ deprecated and will be removed in a future version</b> - so please switch to the
are replaced by a new set of renderer classes. Note that the new renderer classes will produce
code that is the same as the prior methods with very few exceptions - and those exceptions are related to
bugs in the old methods.</li>
<li>The attribute "implementationPackage" has been removed from the <code>&lt;javaClientGenerator&gt;</code>
configuration. It was only used for iBatis.</li>
</ul>

<h3>Other Changes</h3>
Expand Down