Skip to content

Commit

Permalink
Complex return types based on String properties should be evaluated o…
Browse files Browse the repository at this point in the history
…nce. (#229)
  • Loading branch information
ajoymajumdar committed Feb 6, 2018
1 parent 81ae603 commit 5225bb5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public static class Metadata {
public static class Delete {
private boolean enableForTable = true;
private String enableDeleteForQualifiedNames;
private Set<QualifiedName> enableDeleteForQualifiedNamesSet;

/**
* Get the names stored in the variable as a List of fully qualified names.
Expand All @@ -65,8 +66,11 @@ public static class Delete {
*/
@JsonIgnore
public Set<QualifiedName> getQualifiedNamesEnabledForDelete() {
return PropertyUtils.delimitedStringsToQualifiedNamesSet(this.enableDeleteForQualifiedNames,
',');
if (enableDeleteForQualifiedNamesSet == null) {
enableDeleteForQualifiedNamesSet =
PropertyUtils.delimitedStringsToQualifiedNamesSet(this.enableDeleteForQualifiedNames, ',');
}
return enableDeleteForQualifiedNamesSet;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public static class Refresh {
public static class Include {
private String catalogs;
private String databases;
private List<QualifiedName> databasesList;

/**
* Get the databases stored in the variable as a List of fully qualified names.
Expand All @@ -132,9 +133,12 @@ public static class Include {
*/
@JsonIgnore
public List<QualifiedName> getDatabasesAsListOfQualfiedNames() {
return this.databases == null
? Lists.newArrayList()
: PropertyUtils.delimitedStringsToQualifiedNamesList(this.databases, ',');
if (databasesList == null) {
databasesList = this.databases == null
? Lists.newArrayList()
: PropertyUtils.delimitedStringsToQualifiedNamesList(this.databases, ',');
}
return databasesList;
}
}

Expand All @@ -159,6 +163,7 @@ public static class Exclude {
@Data
public static class Qualified {
private String names;
private List<QualifiedName> namesList;

/**
* Get the names stored in the variable as a List of fully qualified names.
Expand All @@ -167,9 +172,12 @@ public static class Qualified {
*/
@JsonIgnore
public List<QualifiedName> getNamesAsListOfQualifiedNames() {
return this.names == null
? Lists.newArrayList()
: PropertyUtils.delimitedStringsToQualifiedNamesList(this.names, ',');
if (namesList == null) {
namesList = this.names == null
? Lists.newArrayList()
: PropertyUtils.delimitedStringsToQualifiedNamesList(this.names, ',');
}
return namesList;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,19 @@ public static class Partitions {
@Data
public static class No {
private String filter;
private java.util.List<QualifiedName> filterList;

/**
* Get the filter list as a list of qualified names.
*
* @return The filtered list
*/
public java.util.List<QualifiedName> getFilterAsListOfQualifiedNames() {
if (this.filter != null) {
return PropertyUtils.delimitedStringsToQualifiedNamesList(filter, ',');
} else {
return Lists.newArrayList();
if (filterList == null) {
filterList = filter == null ? Lists.newArrayList()
: PropertyUtils.delimitedStringsToQualifiedNamesList(filter, ',');
}
return filterList;
}
}
}
Expand Down

0 comments on commit 5225bb5

Please sign in to comment.