use of org.jboss.forge.roaster.model.Parameter in project kie-wb-common by kiegroup.
the class JavaRoasterModelDriver method addMethod.
private void addMethod(org.kie.workbench.common.services.datamodeller.core.JavaClass javaClass, Method method, ClassTypeResolver classTypeResolver) throws ClassNotFoundException, ModelDriverException {
List<Parameter> parameters = method.getParameters();
List<org.kie.workbench.common.services.datamodeller.core.Parameter> modelParameters = new ArrayList<>();
if (parameters != null) {
for (Parameter parameter : parameters) {
modelParameters.add(new org.kie.workbench.common.services.datamodeller.core.impl.ParameterImpl(new org.kie.workbench.common.services.datamodeller.core.impl.TypeImpl(resolveTypeName(classTypeResolver, parameter.getType().getName()), resolveTypeArguments(parameter.getType().getTypeArguments())), parameter.getName()));
}
}
org.kie.workbench.common.services.datamodeller.core.Type returnType = null;
if (method.getReturnType() != null) {
returnType = new org.kie.workbench.common.services.datamodeller.core.impl.TypeImpl(resolveTypeName(classTypeResolver, method.getReturnType().getName()), resolveTypeArguments(method.getReturnType().getTypeArguments()));
}
Visibility visibility = Visibility.PACKAGE_PRIVATE;
if (method.getVisibility() != null) {
visibility = DriverUtils.buildVisibility(method.getVisibility());
}
MethodImpl dataObjectMethod = new MethodImpl(method.getName(), modelParameters, method.getBody(), returnType, visibility);
List<AnnotationSource<JavaClassSource>> annotations = method.getAnnotations();
if (annotations != null) {
for (AnnotationSource annotation : annotations) {
dataObjectMethod.addAnnotation(createAnnotation(annotation, classTypeResolver));
}
}
javaClass.addMethod(dataObjectMethod);
}
Aggregations