private void initReservationRequestsList() { if (this.reservationRequests != null) { return; } ReservationRequestsProtoOrBuilder p = viaProto ? proto : builder; List<ReservationRequestProto> resourceProtos = p.getReservationResourcesList(); reservationRequests = new ArrayList<ReservationRequest>(); for (ReservationRequestProto r : resourceProtos) { reservationRequests.add(convertFromProtoFormat(r)); } }
private void addReservationResourcesToProto() { maybeInitBuilder(); builder.clearReservationResources(); if (reservationRequests == null) return; Iterable<ReservationRequestProto> iterable = new Iterable<ReservationRequestProto>() { @Override public Iterator<ReservationRequestProto> iterator() { return new Iterator<ReservationRequestProto>() { Iterator<ReservationRequest> iter = reservationRequests .iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public ReservationRequestProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllReservationResources(iterable); }
private ReservationRequestProto convertToProtoFormat(ReservationRequest r) { return ((ReservationRequestPBImpl) r).getProto(); }
private ReservationRequestPBImpl convertFromProtoFormat( ReservationRequestProto r) { return new ReservationRequestPBImpl(r); }
public ReservationRequestPBImpl() { builder = ReservationRequestProto.newBuilder(); }
public ReservationRequestPBImpl(ReservationRequestProto proto) { this.proto = proto; viaProto = true; }
public ReservationRequestProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); viaProto = true; return proto; }
private void maybeInitBuilder() { if (viaProto || builder == null) { builder = ReservationRequestProto.newBuilder(proto); } viaProto = false; }