Package com.scivicslab.pojoactor.core
Class AttributeKey<T>
java.lang.Object
com.scivicslab.pojoactor.core.AttributeKey<T>
- Type Parameters:
T- the type of value this key carries
A type-safe key for storing named attributes on an ActorRef.
Declare keys as static constants to establish a vocabulary of actor attributes. This prevents typos and enforces the type contract at the put/get boundary.
static final AttributeKey<Long> START_TIME = AttributeKey.of("startTime", Long.class);
static final AttributeKey<String> REQUEST_ID = AttributeKey.of("requestId", String.class);
ref.putAttribute(START_TIME, System.currentTimeMillis());
Long t = ref.getAttribute(START_TIME);
- Since:
- 2.16.0
-
Method Summary