io.smallrye.mutiny.vertx.codegen.lang.BufferRelatedMethodCodeWriter Maven / Gradle / Ivy
package io.smallrye.mutiny.vertx.codegen.lang;
import java.io.PrintWriter;
import io.vertx.codegen.ClassModel;
import io.vertx.core.buffer.Buffer;
/**
* Add the buffer specific methods.
*/
public class BufferRelatedMethodCodeWriter implements ConditionalCodeWriter {
@Override
public void generate(ClassModel model, PrintWriter writer) {
writer.println(" @Override");
writer.println(" public void writeToBuffer(io.vertx.core.buffer.Buffer buffer) {");
writer.println(" delegate.writeToBuffer(buffer);");
writer.println(" }");
writer.println();
writer.println(" @Override");
writer.println(" public int readFromBuffer(int pos, io.vertx.core.buffer.Buffer buffer) {");
writer.println(" return delegate.readFromBuffer(pos, buffer);");
writer.println(" }");
writer.println();
}
@Override
public boolean test(ClassModel model) {
return model.isConcrete() && model.getType().getName().equals(Buffer.class.getName());
}
}