public class AnnotatedHandlerAttributes extends Object implements HandlerAttributes
AnnotatedElement
. It does so by
validating all (meta-)annotations of the given element for the presence of the HasHandlerAttributes
annotation. Each found (meta-)annotation's attributes will be included.
This implementation can discover several collections of attributes. All attributes are prefixed with the simple name
of the annotation (meta-)annotated with HasHandlerAttributes
, separated by a dot.
AGGREGATE_CREATION_POLICY, ALLOW_REPLAY, COMMAND_NAME, COMMAND_ROUTING_KEY, EXCEPTION_RESULT_TYPE, FORCE_NEW_SAGA, MESSAGE_TYPE, PAYLOAD_TYPE, QUERY_NAME, RESULT_TYPE, SAGA_ASSOCIATION_PROPERTY, SAGA_ASSOCIATION_PROPERTY_KEY_NAME, SAGA_ASSOCIATION_RESOLVER, SHUTDOWN_PHASE, START_PHASE
Constructor and Description |
---|
AnnotatedHandlerAttributes(AnnotatedElement annotatedElement)
Create an
AnnotatedHandlerAttributes containing all attributes of annotations (meta-)annotated with
HasHandlerAttributes on the given annotatedElement . |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(String attributeKey)
Validates whether the given
attributeKey is present in this object. |
boolean |
equals(Object o) |
<R> R |
get(String attributeKey)
Retrieve the attribute for the given
attributeKey . |
Map<String,Object> |
getAll()
Retrieve all attributes stored in this
HandlerAttributes object. |
int |
hashCode() |
boolean |
isEmpty()
Validate whether zero attributes are present in this object.
|
HandlerAttributes |
mergedWith(HandlerAttributes other)
|
String |
toString() |
public AnnotatedHandlerAttributes(AnnotatedElement annotatedElement)
AnnotatedHandlerAttributes
containing all attributes of annotations (meta-)annotated with
HasHandlerAttributes
on the given annotatedElement
. Each attribute will be stored based on the
simple name of the annotation (meta-)annotated with HasHandlerAttributes
combined with the attribute
name.
The handler annotation name and attribute name are separated by dots. This leads to a key format of "[handlerType].[attributeName]"
.
annotatedElement
- the AnnotatedElement
to extract handler attributes forpublic <R> R get(String attributeKey)
HandlerAttributes
attributeKey
. Might be null
if there is no attribute present
for the given key.get
in interface HandlerAttributes
R
- the type of attribute to retrieveattributeKey
- the attribute key to retrieve an attribute forattributeKey
public Map<String,Object> getAll()
HandlerAttributes
HandlerAttributes
object.getAll
in interface HandlerAttributes
HandlerAttributes
objectpublic boolean contains(String attributeKey)
HandlerAttributes
attributeKey
is present in this object.contains
in interface HandlerAttributes
attributeKey
- the attribute key to validate if it is present in this objecttrue
if there is an attribute for the given attributeKey
present, false
otherwisepublic boolean isEmpty()
HandlerAttributes
isEmpty
in interface HandlerAttributes
true
if there are no attributes present, false
otherwisepublic HandlerAttributes mergedWith(HandlerAttributes other)
HandlerAttributes
HandlerAttributes
, merging the attributes in this
instance with the given attributes
. If this
and other
have identical entries, the values from other
will take
precedence.mergedWith
in interface HandlerAttributes
other
- the HandlerAttributes
to group with this
instance's attributesHandlerAttributes
combining this
instance's attributes and the given other
attributesCopyright © 2010–2023. All rights reserved.