| 限定符和类型 | 字段和说明 |
|---|---|
(专用程序包) static String |
COLLECTOR_CONTEXT_THREAD_LOCAL_KEY |
| 构造器和说明 |
|---|
CollectorContext() |
| 限定符和类型 | 方法和说明 |
|---|---|
<E> void |
add(String name,
Collector<E> collector)
Adds a collector with give name.
|
<E> void |
add(String name,
Object object)
Adds a collector or a simple object with give name.
|
void |
combineWithCollector(String name,
Object data)
Combines data with Collector identified by the given name.
|
Object |
get(String name)
Gets the data associated with a given name.
|
Map<String,Object> |
getAll()
Returns all the collected data.
|
static CollectorContext |
getInstance() |
(专用程序包) void |
loadCollectors()
Loads data from all collectors.
|
(专用程序包) void |
reset()
Reset the context
|
public static CollectorContext getInstance()
public <E> void add(String name, Collector<E> collector)
E - elementname - Stringcollector - Collectorpublic <E> void add(String name, Object object)
E - elementobject - Objectname - Stringpublic Object get(String name)
Collector instances you should wait till the validation is complete
to gather all data.
When CollectorContext is used to collect Collector instances
for a particular key, this method will return the Collector instance
as long as loadCollectors() method is not called. Once
the loadCollectors() method is called this method will
return the actual data collected by collector.
name - Stringpublic Map<String,Object> getAll()
get(String) method for more details.public void combineWithCollector(String name, Object data)
name - Stringdata - Objectvoid reset()
void loadCollectors()
Copyright © 2023. All rights reserved.