Class AnnotatedEntityIdResolver<ID>
- Type Parameters:
ID- The type of the identifier to resolve.
- All Implemented Interfaces:
DescribableComponent,EntityIdResolver<ID>
EntityIdResolver that converts the payload through the configured
MessageConverter then takes the expected representation of the message handler from the
AnnotatedEntityMetamodel.
It will then use the delegate EntityIdResolver to resolve the id, defaulting to the
AnnotationBasedEntityIdResolver.
- Since:
- 5.0.0
- Author:
- Mitchell Herrijgers
-
Constructor Summary
ConstructorsConstructorDescriptionAnnotatedEntityIdResolver(AnnotatedEntityMetamodel<?> metamodel, Class<ID> idType, MessageConverter converter, EntityIdResolver<ID> delegate) Constructs anAnnotatedEntityMetamodelEntityIdResolverfor the providedAnnotatedEntityMetamodel. -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.resolve(Message message, ProcessingContext context) Resolve the id of the entity from the givenmessageandcontext.
-
Constructor Details
-
AnnotatedEntityIdResolver
public AnnotatedEntityIdResolver(@Nonnull AnnotatedEntityMetamodel<?> metamodel, @Nonnull Class<ID> idType, @Nonnull MessageConverter converter, @Nonnull EntityIdResolver<ID> delegate) Constructs anAnnotatedEntityMetamodelEntityIdResolverfor the providedAnnotatedEntityMetamodel.- Parameters:
metamodel- The metamodel that dictates the expected representation of the message.idType- The type of the id that will be resolved.converter- TheMessageConverterto use.delegate- TheEntityIdResolverto use on the message after conversion.
-
-
Method Details
-
resolve
@Nonnull public ID resolve(@Nonnull Message message, @Nonnull ProcessingContext context) throws EntityIdResolutionException Description copied from interface:EntityIdResolverResolve the id of the entity from the givenmessageandcontext.- Specified by:
resolvein interfaceEntityIdResolver<ID>- Parameters:
message- The message to resolve the id from.context- The context in which the message is processed.- Returns:
- The id of the entity.
- Throws:
EntityIdResolutionException- When the id could not be resolved.
-
describeTo
Description copied from interface:DescribableComponentDescribe the properties ofthis DescribableComponentwith the givendescriptor.Components should call the appropriate
describePropertymethods on the descriptor to register their properties. The descriptor is responsible for determining how these properties are formatted and structured in the final output.Best Practices: As a general rule, all relevant fields of a
DescribableComponentimplementation should be described in this method. However, developers have discretion to include only the fields that make sense in the context. Not every field may be meaningful for description purposes, especially internal implementation details. Furthermore, components might want to expose different information based on their current state. The final decision on what properties to include lies with the person implementing thedescribeTomethod, who should focus on providing information that is useful for understanding the component's configuration and state.Example implementation:
public void describeTo(ComponentDescriptor descriptor) { descriptor.describeProperty("name", this.name); descriptor.describeProperty("enabled", this.enabled); descriptor.describeProperty("configuration", this.configuration); // A nested component descriptor.describeProperty("handlers", this.eventHandlers); // A collection }- Specified by:
describeToin interfaceDescribableComponent- Parameters:
descriptor- The component descriptor to describethis DescribableComponentn its properties in.
-