private void initCompletionEvents() { if (this.completionEvents != null) { return; } GetTaskAttemptCompletionEventsResponseProtoOrBuilder p = viaProto ? proto : builder; List<TaskAttemptCompletionEventProto> list = p.getCompletionEventsList(); this.completionEvents = new ArrayList<TaskAttemptCompletionEvent>(); for (TaskAttemptCompletionEventProto c : list) { this.completionEvents.add(convertFromProtoFormat(c)); } }
private void addCompletionEventsToProto() { maybeInitBuilder(); builder.clearCompletionEvents(); if (completionEvents == null) return; Iterable<TaskAttemptCompletionEventProto> iterable = new Iterable<TaskAttemptCompletionEventProto>() { @Override public Iterator<TaskAttemptCompletionEventProto> iterator() { return new Iterator<TaskAttemptCompletionEventProto>() { Iterator<TaskAttemptCompletionEvent> iter = completionEvents.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public TaskAttemptCompletionEventProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllCompletionEvents(iterable); }
private TaskAttemptCompletionEventPBImpl convertFromProtoFormat(TaskAttemptCompletionEventProto p) { return new TaskAttemptCompletionEventPBImpl(p); }
private TaskAttemptCompletionEventProto convertToProtoFormat(TaskAttemptCompletionEvent t) { return ((TaskAttemptCompletionEventPBImpl)t).getProto(); }
public TaskAttemptCompletionEventPBImpl() { builder = TaskAttemptCompletionEventProto.newBuilder(); }
public TaskAttemptCompletionEventPBImpl(TaskAttemptCompletionEventProto proto) { this.proto = proto; viaProto = true; }
public TaskAttemptCompletionEventProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); viaProto = true; return proto; }
private void maybeInitBuilder() { if (viaProto || builder == null) { builder = TaskAttemptCompletionEventProto.newBuilder(proto); } viaProto = false; }