Skip to content

Commit

Permalink
Adding toClassOrInterfaceType for fabric8io#4865
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajdeep-Paul-117 committed Feb 12, 2023
1 parent c0cf3d0 commit 61aa42d
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ private String getSortedFieldsAsParam(Set<String> list) {
return sb.toString();
}

public static ClassOrInterfaceType toClassOrInterfaceType( String className ) {
String withoutDollars = className.replace("$", "."); // nested class in Java cannot be used in casts
return withoutDollars.indexOf('<') >= 0 ? StaticJavaParser.parseClassOrInterfaceType(withoutDollars) : new ClassOrInterfaceType(null, withoutDollars);
}

@Override
public GeneratorResult generateJava() {
CompilationUnit cu = new CompilationUnit();
Expand Down Expand Up @@ -156,8 +161,8 @@ public GeneratorResult generateJava() {
addExtraAnnotations(clz);
}

clz.addImplementedType("io.fabric8.kubernetes.api.model.KubernetesResource");

clz.addImplementedType(new ClassOrInterfaceType(null, "io.fabric8.kubernetes.api.model.KubernetesResource"));
List<GeneratorResult.ClassResult> buffer = new ArrayList<>(this.fields.size() + 1);

List<String> sortedKeys = this.fields.keySet().stream().sorted().collect(Collectors.toList());
Expand Down

0 comments on commit 61aa42d

Please sign in to comment.