private void encodeTrigger(JobTrigger trigger, Bundle data) {
    if (trigger == Trigger.NOW) {
      data.putInt(
          prefix + BundleProtocol.PACKED_PARAM_TRIGGER_TYPE, BundleProtocol.TRIGGER_TYPE_IMMEDIATE);
    } else if (trigger instanceof JobTrigger.ExecutionWindowTrigger) {
      JobTrigger.ExecutionWindowTrigger t = (JobTrigger.ExecutionWindowTrigger) trigger;

      data.putInt(
          prefix + BundleProtocol.PACKED_PARAM_TRIGGER_TYPE,
          BundleProtocol.TRIGGER_TYPE_EXECUTION_WINDOW);
      data.putInt(prefix + BundleProtocol.PACKED_PARAM_TRIGGER_WINDOW_START, t.getWindowStart());
      data.putInt(prefix + BundleProtocol.PACKED_PARAM_TRIGGER_WINDOW_END, t.getWindowEnd());
    } else if (trigger instanceof JobTrigger.ContentUriTrigger) {
      data.putInt(
          prefix + BundleProtocol.PACKED_PARAM_TRIGGER_TYPE,
          BundleProtocol.TRIGGER_TYPE_CONTENT_URI);
      ContentUriTrigger uriTrigger = (ContentUriTrigger) trigger;
      String jsonTrigger = convertObservedUrisToJsonString(uriTrigger.getUris());
      data.putString(prefix + BundleProtocol.PACKED_PARAM_OBSERVED_URI, jsonTrigger);
    } else {
      throw new IllegalArgumentException("Unsupported trigger.");
    }
  }
JobCoder is a tool to encode and decode JobSpecs from Bundles.
jobdispatcher/src/main/java/com/firebase/jobdispatcher/JobCoder.java