Class TranslationRuntimeLimits

java.lang.Object
com.lokalized.TranslationRuntimeLimits

@Immutable public final class TranslationRuntimeLimits extends Object
Immutable safety limits for translation construction and evaluation.

The defaults are deliberately generous enough for normal localized strings while bounding work that is proportional to untrusted localized strings data or runtime values. Builders may customize a limit through the library's hard ceiling. Localized strings loaders validate expressions against hard ceilings because an application's runtime policy is not yet available; Strings construction then enforces its configured limits. A single instance is safe to share between Strings instances and threads.

Caller-supplied CharSequence values are length-checked before Lokalized scans, copies, bidi-isolates, or materializes them for phonetic resolution. The interpolated-output limit also bounds one phonetic input. For other placeholder object types, Lokalized must invoke application-defined Object.toString() code before it can measure the result; these limits bound Lokalized's subsequent work but cannot bound work performed inside that application method. Use a pre-bounded String or CharSequence when runtime values originate from untrusted input.

Expression source, token, and nesting limits apply equally to whole-message alternative predicates and expression-fragment predicates. Generated-placeholder depth and cumulative expansion limits are shared by language-form fragments and expression-selected fragments, including dependencies that cross between the two kinds.

Since:
3.0.0
Author:
Mark Allen