Class AttrValues
java.lang.Object
codes.grow.packages.betterstack.logging.AttrValues
Normalises attribute values (
AttrValue) into the kinds the SDK accepts.
An attribute value is one of: String, Long (all integral numbers), Double (all floating point numbers), Boolean, List<Object> of attribute values
or Map<String, Object> of attribute values. normalize(Object) converts other
inputs: Integer/Short/Byte/BigInteger (when it fits) become
Long, Float/BigDecimal become Double, arrays and collections
become immutable lists, maps become immutable insertion-ordered maps with string keys and
anything else becomes its toString(). null has no attribute value: null list
items and map entries with a null value are dropped; normalize(java.lang.Object) of a bare null
returns the empty string (kept for compatibility).
-
Method Summary
Modifier and TypeMethodDescriptionMerges attribute maps; later maps win on key collisions.static ObjectReturns the normalised, deeply immutable form ofvalue.normalizeMap(Map<?, ?> map) Normalises every value of a map; keys become strings.
-
Method Details
-
normalize
Returns the normalised, deeply immutable form ofvalue.- Parameters:
value- any value- Returns:
- a valid attribute value (
""fornull)
-
normalizeMap
Normalises every value of a map; keys become strings.nullgives an empty map.- Parameters:
map- attributes (may benull)- Returns:
- an immutable, insertion-ordered copy
-
merge
Merges attribute maps; later maps win on key collisions.- Parameters:
maps- maps in order of increasing precedence (nullentries are skipped)- Returns:
- an immutable merged map
-