@NonNull
  private JobTrigger decodeTrigger(Bundle data) {
    switch (data.getInt(prefix + BundleProtocol.PACKED_PARAM_TRIGGER_TYPE)) {
      case BundleProtocol.TRIGGER_TYPE_IMMEDIATE:
        return Trigger.NOW;

      case BundleProtocol.TRIGGER_TYPE_EXECUTION_WINDOW:
        return Trigger.executionWindow(
            data.getInt(prefix + BundleProtocol.PACKED_PARAM_TRIGGER_WINDOW_START),
            data.getInt(prefix + BundleProtocol.PACKED_PARAM_TRIGGER_WINDOW_END));

      case BundleProtocol.TRIGGER_TYPE_CONTENT_URI:
        String uris = data.getString(prefix + BundleProtocol.PACKED_PARAM_OBSERVED_URI);
        List<ObservedUri> observedUris = convertJsonToObservedUris(uris);
        return Trigger.contentUriTrigger(Collections.unmodifiableList(observedUris));

      default:
        if (Log.isLoggable(TAG, Log.DEBUG)) {
          Log.d(TAG, "Unsupported trigger.");
        }
        return null;
    }
  }
JobCoder is a tool to encode and decode JobSpecs from Bundles.
jobdispatcher/src/main/java/com/firebase/jobdispatcher/JobCoder.java