Package com.illumon.iris.db.util.caching
Class C14nUtil
java.lang.Object
com.illumon.iris.db.util.caching.C14nUtil
public class C14nUtil extends Object
-
Field Summary
-
Constructor Summary
Constructors Constructor Description C14nUtil() -
Method Summary
Modifier and Type Method Description static com.fishlib.datastructures.util.SmartKeymakeSmartKey(Object... values)Make a SmartKey appropriate for values.static <T> TmaybeCanonicalize(T item)Canonicalize an object using the default CanonicalizationCache, if it's an instance of a known appropriate class.static <T> booleanmaybeCanonicalizeAll(T[] items)Canonicalizes an array of objects in-place using the default CanonicalizationCache, if they're instances of known appropriate classes.static ObjectmaybeMakeSmartKey(Object... values)If there is one value and it is null, return a special singleton smart key that we have created for this purpose.
-
Field Details
-
Constructor Details
-
C14nUtil
public C14nUtil()
-
-
Method Details
-
maybeCanonicalize
public static <T> T maybeCanonicalize(T item)Canonicalize an object using the default CanonicalizationCache, if it's an instance of a known appropriate class.- Type Parameters:
T-- Parameters:
item-- Returns:
- null if item was null, else the canonicalized version of item if its class was eligible, else item
-
maybeCanonicalizeAll
public static <T> boolean maybeCanonicalizeAll(@NotNull T[] items)Canonicalizes an array of objects in-place using the default CanonicalizationCache, if they're instances of known appropriate classes. May canonicalize some items without canonicalizing all.- Parameters:
items-- Returns:
- true if all non-null items were canonicalized, else false.
-
makeSmartKey
Make a SmartKey appropriate for values.- Parameters:
values-- Returns:
- A canonicalized CanonicalizedSmartKey if all values are canonicalizable, else a new SmartKey
-
maybeMakeSmartKey
If there is one value and it is null, return a special singleton smart key that we have created for this purpose. If there is one value and it is not null, hand it to maybeCanonicalize, which will either make a smart key out of it or return the value itself. Otherwise (if there are zero values or more than one value), then hand off to makeSmartKey which will make a CanonicalizedSmartKey (if possible) or a SmartKey (otherwise).- Parameters:
values- the value or values to turn into a key- Returns:
- a potentially canonicalized key for use in a map
-