com.rollbar.notifier.truncation.TruncationStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rollbar-java Show documentation
Show all versions of rollbar-java Show documentation
For connecting your applications built on the JVM to Rollbar for Error Reporting
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);
}
}
}