use of io.sundr.builder.internal.utils.BuilderUtils.findBuildableConstructor in project sundrio by sundrio.
the class ToPojo method convertReference.
/**
* Converts a reference from the source type, to the target.
*
* @param ref The ref.
* @param source The source type of the reference..
* @param target The target type.
* @return
*/
private static String convertReference(String ref, TypeDef source, TypeDef target) {
Method ctor = BuilderUtils.findBuildableConstructor(target);
String arguments = ctor.getArguments().stream().map(p -> readProperty(ref, source, p)).collect(joining(",\n "));
StringBuilder sb = new StringBuilder();
sb.append("new ").append(target.getFullyQualifiedName()).append("(").append(arguments).append(")");
return sb.toString();
}
use of io.sundr.builder.internal.utils.BuilderUtils.findBuildableConstructor in project sundrio by sundrio.
the class ToPojo method convertMap.
/**
* Converts a map describing the source type, to the target.
*
* @param ref The ref.
* @param source The source type of the reference (e.g. the annotation).
* @param target The target type (e.g. the generated pojo).
* @return
*/
private static String convertMap(String ref, TypeDef source, TypeDef target) {
Method ctor = BuilderUtils.findBuildableConstructor(target);
String arguments = ctor.getArguments().stream().map(p -> readMapValue(ref, source, p)).collect(joining(",\n", "\n", ""));
StringBuilder sb = new StringBuilder();
sb.append("new ").append(target.getFullyQualifiedName()).append("(").append(arguments).append(")");
return sb.toString();
}
Aggregations