@Repeatable(value=ContainerMethod.List.class) @Documented @Target(value={ANNOTATION_TYPE,METHOD,TYPE}) @Retention(value=RUNTIME) public @interface ContainerMethod
Indicates that the annotation or the method pointed to by the annotation can be converted to a method container of the specified type. The annotated method needs to meet the following requirements:
type() is MappingType.MAPPED, the return value type must be Map;type() is not MappingType.MAPPED,
the return value can be a single object, array or Collection;
For example, the following example describes how to adapt the requestFoo() method to a data source container:
The first way is to add annotations directly on the method:
{@codecn.crane4j.core.support.container.DefaultMethodContainerFactory,
cn.crane4j.core.support.container.ContainerMethodAnnotationProcessor| 限定符和类型 | 必需的元素和说明 |
|---|---|
Class<?> |
resultType
Data source object type returned by method.
|
| 限定符和类型 | 可选元素和说明 |
|---|---|
String |
bindMethod
The name of method which will be used to adapt the method container.
|
Class<?>[] |
bindMethodParamTypes
The parameter types of the method which will be used to adapt the method container.
|
String |
namespace
Namespace of the data source container, use method name when empty.
|
String |
resultKey
The key field of the data source object returned by the method.
|
MappingType |
type
The mapping relationship between the object returned by the method and the target object.
|
public abstract Class<?> resultType
type() is MappingType.MAPPED, this parameter is ignored.public abstract String namespace
public abstract MappingType type
public abstract String resultKey
type() is MappingType.MAPPED, this parameter is ignored.public abstract String bindMethod
namespace()public abstract Class<?>[] bindMethodParamTypes
Copyright © 2023. All rights reserved.