use of com.yahoo.aptutils.writer.parameters.MethodDeclarationParameters in project squidb by yahoo.
the class BasicPropertyGenerator method emitSetter.
@Override
public final void emitSetter(JavaFileWriter writer) throws IOException {
if (isDeprecated) {
return;
}
MethodDeclarationParameters params = setterMethodParams();
modelSpec.getPluginBundle().beforeEmitSetter(writer, this, params);
writer.beginMethodDefinition(params);
writeSetterBody(writer, params);
writer.finishMethodDefinition();
modelSpec.getPluginBundle().afterEmitSetter(writer, this, params);
}
use of com.yahoo.aptutils.writer.parameters.MethodDeclarationParameters in project squidb by yahoo.
the class ModelMethodPlugin method emitModelMethod.
private void emitModelMethod(JavaFileWriter writer, ExecutableElement e, Modifier... modifiers) throws IOException {
MethodDeclarationParameters params = utils.methodDeclarationParamsFromExecutableElement(e, modifiers);
ModelMethod methodAnnotation = e.getAnnotation(ModelMethod.class);
List<Object> arguments = new ArrayList<>();
if (methodAnnotation != null) {
String name = methodAnnotation.name();
if (!AptUtils.isEmpty(name)) {
params.setMethodName(name);
}
params.getArgumentTypes().remove(0);
params.getArgumentNames().remove(0);
arguments.add(0, "this");
}
arguments.addAll(params.getArgumentNames());
Expression methodCall = Expressions.staticMethod(modelSpec.getModelSpecName(), e.getSimpleName().toString(), arguments);
if (!CoreTypes.VOID.equals(params.getReturnType())) {
methodCall = methodCall.returnExpr();
}
JavadocPlugin.writeJavadocFromElement(pluginEnv, writer, e);
writer.beginMethodDefinition(params).writeStatement(methodCall).finishMethodDefinition();
}
Aggregations