Class BundleLookupThreadContext
- java.lang.Object
-
- com.aoindustries.util.i18n.BundleLookupThreadContext
-
public final class BundleLookupThreadContext extends Object
Each thread has a markup context associated with it. When set, bundle lookups will be recorded with any markup-context appropriate prefixes and suffixes added. This allows the use of a normal API while providing a mechanism for in-context translation interfaces to better integrate with the underlying resource bundles.
Under concurrent programming, one context can end up being accessed concurrently by multiple threads, thus BundleLookupThreadContext is a thread-safe implementation.
Bundle lookups are not guaranteed to be recorded, such as when in-context translation is disabled (production mode).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description BundleLookupMarkupgetLookupMarkup(String result)Gets the lookup markup for the given String ornullif not found.static BundleLookupThreadContextgetThreadContext()Gets the current context for the current thread ornullif none set.static BundleLookupThreadContextgetThreadContext(boolean createIfMissing)Deprecated.Please usegetThreadContext()directly, since this content is now added and removed based on the current thread settings.static voidremoveThreadContext()Deprecated.This should not be used directly and will become inaccessible in a future major version release, since this content is now added and removed based on the current thread settings.voidreset()Deprecated.Lookups are no longer reset.
-
-
-
Method Detail
-
getThreadContext
@Deprecated public static BundleLookupThreadContext getThreadContext(boolean createIfMissing)
Deprecated.Please usegetThreadContext()directly, since this content is now added and removed based on the current thread settings.Gets the current context for the current thread ornullif none set and none created.
-
getThreadContext
public static BundleLookupThreadContext getThreadContext()
Gets the current context for the current thread ornullif none set. This content is added and removed based on the current thread settings.
-
removeThreadContext
@Deprecated public static void removeThreadContext()
Deprecated.This should not be used directly and will become inaccessible in a future major version release, since this content is now added and removed based on the current thread settings.Removes any current context.
-
reset
@Deprecated public void reset()
Deprecated.Lookups are no longer reset. Instead, they are now added and removed based on the current thread settings.Removes all lookups stored in this context.
-
getLookupMarkup
public BundleLookupMarkup getLookupMarkup(String result)
Gets the lookup markup for the given String ornullif not found.The string is looked-up by identity only:
String.equals(java.lang.Object)is not called. This is to give a more precise match to lookups. Much care is taken care to support this string identity lookup, including things like resource bundles, I/O buffers, and tag attribute manipulation.
-
-