private void initTaskReports() { if (this.taskReports != null) { return; } GetTaskReportsResponseProtoOrBuilder p = viaProto ? proto : builder; List<TaskReportProto> list = p.getTaskReportsList(); this.taskReports = new ArrayList<TaskReport>(); for (TaskReportProto c : list) { this.taskReports.add(convertFromProtoFormat(c)); } }
private void addTaskReportsToProto() { maybeInitBuilder(); builder.clearTaskReports(); if (taskReports == null) return; Iterable<TaskReportProto> iterable = new Iterable<TaskReportProto>() { @Override public Iterator<TaskReportProto> iterator() { return new Iterator<TaskReportProto>() { Iterator<TaskReport> iter = taskReports.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public TaskReportProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllTaskReports(iterable); }
private TaskReportPBImpl convertFromProtoFormat(TaskReportProto p) { return new TaskReportPBImpl(p); }
private TaskReportProto convertToProtoFormat(TaskReport t) { return ((TaskReportPBImpl)t).getProto(); }
public TaskReportPBImpl() { builder = TaskReportProto.newBuilder(); }
public TaskReportPBImpl(TaskReportProto proto) { this.proto = proto; viaProto = true; }
public TaskReportProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); viaProto = true; return proto; }
private void maybeInitBuilder() { if (viaProto || builder == null) { builder = TaskReportProto.newBuilder(proto); } viaProto = false; }