Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Lists are now always initialized in generated POJOs
Browse files Browse the repository at this point in the history
Fixes previous commit
  • Loading branch information
Aleksandar Stojsavljevic committed Apr 11, 2017
1 parent 27d419a commit e47dfdf
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ public PojoBuilder withField(String name, String type, String comment, RamlTypeV

try {
//If this class is a collection (List)- lets add an import
if (resolvedType.fullName().startsWith(List.class.getSimpleName() +"<")) {
if (resolvedType.fullName().startsWith(List.class.getName() +"<")) {
resolvedType = this.pojo.owner().ref(List.class).narrow(resolvedType.getTypeParameters().get(0));
}
//If this class is a collection (Set) - lets add an import
if (resolvedType.fullName().startsWith(Set.class.getSimpleName() +"<")) {
if (resolvedType.fullName().startsWith(Set.class.getName() +"<")) {
resolvedType = this.pojo.owner().ref(Set.class).narrow(resolvedType.getTypeParameters().get(0));
}
} catch (Exception ex) {
Expand Down Expand Up @@ -211,7 +211,7 @@ public PojoBuilder withField(String name, String type, String comment, RamlTypeV
&& ((JDefinedClass) resolvedType).getClassType().equals(ClassType.ENUM)) {
jExpression = JExpr.direct(resolvedType.name() + "." + NamingHelper.cleanNameForJavaEnum(defaultValue));
}
} else if(resolvedType.fullName().startsWith(List.class.getSimpleName() +"<")){
} else if(resolvedType.fullName().startsWith(List.class.getName() +"<")){
JClass narrowedListClass = this.pojoModel.ref(ArrayList.class).narrow(resolvedType.getTypeParameters().get(0));
jExpression = JExpr._new(narrowedListClass);
}
Expand Down

0 comments on commit e47dfdf

Please sign in to comment.