Skip to content

Commit

Permalink
Added prefix to ignore to SchemaNamer
Browse files Browse the repository at this point in the history
  • Loading branch information
Vamsi Subhash Achanta committed Nov 25, 2018
1 parent 72cacde commit be563fc
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ public class SchemaNamer {

private final String prefixToAttach;
private final String prefixToMatch;
public static final SchemaNamer DEFAULT_SCHEMA_NAMER = new SchemaNamer("", "");
private final String prefixToIgnore;
public static final SchemaNamer DEFAULT_SCHEMA_NAMER = new SchemaNamer("", "", "");

public SchemaNamer(String prefixToAttach, String prefixToMatch) {
public SchemaNamer(String prefixToAttach, String prefixToMatch, String prefixToIgnore) {
this.prefixToAttach = prefixToAttach;
this.prefixToMatch = prefixToMatch;
this.prefixToIgnore = prefixToIgnore;
}

public String getName(Class<?> clazz) {
Expand All @@ -39,7 +41,8 @@ public String getNamespace(Class<?> clazz) {

public String getNamespace(Package pkg) {
String pkgName = pkg.getName();
if (prefixToAttach != null && !"".equals(prefixToAttach) && pkgName.startsWith(prefixToMatch)) {
if (prefixToAttach != null && !"".equals(prefixToAttach) &&
pkgName.startsWith(prefixToMatch) && !pkgName.startsWith(prefixToIgnore)) {
return prefixToAttach + "." + pkgName;
} else {
return pkgName;
Expand Down

0 comments on commit be563fc

Please sign in to comment.