All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rollbar.notifier.truncation.TruncationStrategy Maven / Gradle / Ivy

Go to download

For connecting your applications built on the JVM to Rollbar for Error Reporting

There is a newer version: 2.0.0-alpha.1
Show newest version
package com.rollbar.notifier.truncation;

import com.rollbar.api.payload.Payload;

interface TruncationStrategy {
  /**
   * Truncate the payload.
   * @param payload The payload to be truncated.
   * @return A TruncationResult instance.
   */
  TruncationResult truncate(Payload payload);

  class TruncationResult {
    /**
     * True if the value was truncated.
     */
    public final boolean wasTruncated;
    /**
     * If the value was truncated, this will hold the truncated value. Otherwise this will
     * be null.
     */
    public final T value;

    private TruncationResult(boolean wasTruncated, T result) {
      this.wasTruncated = wasTruncated;
      this.value = result;
    }

    public static  TruncationResult none() {
      return new TruncationResult<>(false, null);
    }

    public static  TruncationResult truncated(T result) {
      return new TruncationResult<>(true, result);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy