@Override public final double getNeededCapacity() { return dto.getNeededCapacity(); }
@Override public JsonElement doSerialize(ParcelDTO src, Type typeOfSrc, JsonSerializationContext context) { final JsonArray arr = new JsonArray(); arr.add(context.serialize(src.getPickupLocation())); arr.add(context.serialize(src.getDeliveryLocation())); arr.add(context.serialize(src.getPickupTimeWindow(), TimeWindow.class)); arr.add( context.serialize(src.getDeliveryTimeWindow(), TimeWindow.class)); arr.add(context.serialize(src.getNeededCapacity())); arr.add(context.serialize(src.getOrderAnnounceTime())); arr.add(context.serialize(src.getPickupDuration())); arr.add(context.serialize(src.getDeliveryDuration())); return arr; } }
@Override public JsonElement doSerialize(ParcelDTO src, Type typeOfSrc, JsonSerializationContext context) { final JsonArray arr = new JsonArray(); arr.add(context.serialize(src.getPickupLocation())); arr.add(context.serialize(src.getDeliveryLocation())); arr.add(context.serialize(src.getPickupTimeWindow(), TimeWindow.class)); arr.add( context.serialize(src.getDeliveryTimeWindow(), TimeWindow.class)); arr.add(context.serialize(src.getNeededCapacity())); arr.add(context.serialize(src.getOrderAnnounceTime())); arr.add(context.serialize(src.getPickupDuration())); arr.add(context.serialize(src.getDeliveryDuration())); return arr; } }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof ParcelDTO) { ParcelDTO that = (ParcelDTO) o; return (this.pickupLocation.equals(that.getPickupLocation())) && (this.deliveryLocation.equals(that.getDeliveryLocation())) && (this.pickupTimeWindow.equals(that.getPickupTimeWindow())) && (this.deliveryTimeWindow.equals(that.getDeliveryTimeWindow())) && (Double.doubleToLongBits(this.neededCapacity) == Double.doubleToLongBits(that.getNeededCapacity())) && (this.orderAnnounceTime == that.getOrderAnnounceTime()) && (this.pickupDuration == that.getPickupDuration()) && (this.deliveryDuration == that.getDeliveryDuration()); } return false; }
Builder(ParcelDTO dto) { pickupLocation = dto.getPickupLocation(); deliveryLocation = dto.getDeliveryLocation(); pickupTimeWindow = dto.getPickupTimeWindow(); deliveryTimeWindow = dto.getDeliveryTimeWindow(); neededCapacity = dto.getNeededCapacity(); orderAnnounceTime = dto.getOrderAnnounceTime(); pickupDuration = dto.getPickupDuration(); deliveryDuration = dto.getDeliveryDuration(); toString = null; }