LogAttributes class final

Extra attributes of an entry.

Attributes of an entry created in this process hold the original values. Attributes read from a store (LogAttributes.fromEncoded) hold LogValue and are converted to the field's type on read via get. So a store does not need to know the app's fields, and an entry equals the original after a save and read.

Annotations
  • @immutable

Constructors

LogAttributes(Iterable<LogAttribute<Object>> attributes)
For a repeated field the last value wins.
LogAttributes.fromEncoded(Map<String, LogValue> encoded)
Attributes from the stored form (encoded): field name and its LogValue, as returned by a store or produced by LogAttributes.encoded.

Properties

encoded → Map<String, LogValue>
Attributes in store form: field name and LogValue.
latefinal
hashCode → int
The hash code for this object.
no setteroverride
isEmpty → bool
no setter
names → Iterable<String>
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

contains(LogField<Object> field) → bool
get<T extends Object>(LogField<T> field) → T?
The attribute's value, or null if absent.
hasValue(LogAttribute<Object> attribute) → bool
Whether attribute attribute is present with the same value. Compares the encoded value (LogValue), so the result is the same for entries created in-process and read from a store.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override
withAll(Iterable<LogAttribute<Object>> attributes) → LogAttributes
Copy with attributes added to the existing ones; for a repeated field the new value wins. Existing attributes are kept as is, including those read from a store. For enriching an entry in a processor: entry.copyWith(attributes: entry.attributes.withAll([buildVersion('1.2.0')])). To let an existing value take precedence, do not add it again: withAll([if (!entry.attributes.contains(userId)) userId(id)]).

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Properties

empty → LogAttributes
final