public abstract class MethodInvokerContainer extends Object implements Container<Object>
Method data source container, specify any method without parameters
or the first parameter is Collection type method,
and adapt it to a data source container.
This container is generally not created directly by users,
but is used in conjunction with MethodInvokerContainerCreator to scan the methods
in a large number of specific context objects in the framework
according to annotations or specific configurations,
automatically adapt them to data source containers and register them.
If only a few known methods need to be used as data sources,
you can directly use LambdaContainer.
MethodContainerFactory,
MethodInvokerContainerCreator,
MappingType| 限定符和类型 | 类和说明 |
|---|---|
static interface |
MethodInvokerContainer.KeyExtractor
The key value extractor is used to obtain the key value from the data source object.
|
protected static class |
MethodInvokerContainer.NoMapping
|
protected static class |
MethodInvokerContainer.OneToMany
|
protected static class |
MethodInvokerContainer.OneToOne
|
protected static class |
MethodInvokerContainer.SingleKey
The container for method with single parameter.
|
protected static class |
MethodInvokerContainer.StandardMethodInvokerContainer
Standard method data source container.
|
Container.Lifecycle| 限定符和类型 | 字段和说明 |
|---|---|
protected @Nullable MethodInvoker |
extractor
The extractor will be used to extract the data from the wrapped object.
|
protected MethodInvoker |
methodInvoker
Method to call.
|
protected String |
namespace
Namespace of method.
|
protected @Nullable Object |
target
Target object of method invocation,
if method is static, this field can be null.
|
EMPTY_CONTAINER_NAMESPACE| 构造器和说明 |
|---|
MethodInvokerContainer() |
| 限定符和类型 | 方法和说明 |
|---|---|
static MethodInvokerContainer |
create(String namespace,
MethodInvoker methodInvoker,
@Nullable Object target,
boolean isMapped)
Create a standard method data source container.
|
protected @Nullable Object |
extractIfPossible(@NonNull Object result)
extract data from the result if possible.
|
static MethodInvokerContainer |
oneToMany(String namespace,
MethodInvoker methodInvoker,
@Nullable Object target,
MethodInvokerContainer.KeyExtractor keyExtractor)
Create a method data source container with a key value extractor.
|
static MethodInvokerContainer |
oneToOne(String namespace,
MethodInvoker methodInvoker,
@Nullable Object target,
MethodInvokerContainer.KeyExtractor keyExtractor,
DuplicateStrategy duplicateStrategy)
Create a method data source container with a key value extractor.
|
static MethodInvokerContainer |
singleKey(String namespace,
MethodInvoker methodInvoker,
@Nullable Object target)
Create a method data source container with only one key value.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitempty, get, getNamespaceprotected final String namespace
protected final MethodInvoker methodInvoker
protected final @Nullable Object target
protected @Nullable MethodInvoker extractor
protected @Nullable Object extractIfPossible(@NonNull Object result)
result - resultpublic static MethodInvokerContainer create(String namespace, MethodInvoker methodInvoker, @Nullable Object target, boolean isMapped)
namespace - namespacemethodInvoker - method to calltarget - object to be called, if the method is static, it can be nullisMapped - MappingType.NO_MAPPINGMethodInvokerContainerpublic static MethodInvokerContainer singleKey(String namespace, MethodInvoker methodInvoker, @Nullable Object target)
namespace - namespacemethodInvoker - method to calltarget - object to be called, if the method is static, it can be nullMethodInvokerContainerpublic static MethodInvokerContainer oneToOne(String namespace, MethodInvoker methodInvoker, @Nullable Object target, MethodInvokerContainer.KeyExtractor keyExtractor, DuplicateStrategy duplicateStrategy)
namespace - namespacemethodInvoker - method to calltarget - object to be called, if the method is static, it can be nullkeyExtractor - key value extraction method of the data source objectduplicateStrategy - duplicate strategyMethodInvokerContainerpublic static MethodInvokerContainer oneToMany(String namespace, MethodInvoker methodInvoker, @Nullable Object target, MethodInvokerContainer.KeyExtractor keyExtractor)
namespace - namespacemethodInvoker - method to calltarget - object to be called, if the method is static, it can be nullkeyExtractor - key value extraction method of the data source objectMethodInvokerContainerCopyright © 2024. All rights reserved.