Tabnine Logo
AggregateAnnotationCommandHandler$Builder
Code IndexAdd Tabnine to your IDE (free)

How to use
AggregateAnnotationCommandHandler$Builder
in
org.axonframework.modelling.command

Best Java code snippets using org.axonframework.modelling.command.AggregateAnnotationCommandHandler$Builder (Showing top 10 results out of 315)

origin: AxonFramework/AxonFramework

commandHandler = new Component<>(() -> parent, "aggregateCommandHandler<" + aggregate.getSimpleName() + ">",
                 c -> AggregateAnnotationCommandHandler.<A>builder()
                     .repository(repository.get())
                     .commandTargetResolver(commandTargetResolver.get())
                     .aggregateModel(metaModel.get())
                     .build());
origin: AxonFramework/AxonFramework

/**
 * Instantiate a {@link AggregateAnnotationCommandHandler} based on the fields contained in the {@link Builder}.
 * <p>
 * Will assert that the {@link Repository} and {@link CommandTargetResolver} are not {@code null}, and will throw
 * an {@link AxonConfigurationException} if either of them is {@code null}. Next to that, the provided Builder's
 * goal is to create an {@link AggregateModel} (describing the structure of a given aggregate). To instantiate this
 * AggregateModel, either an {@link AggregateModel} can be provided directly or an {@code aggregateType} of type
 * {@link Class} can be used. The latter will internally resolve to an AggregateModel. Thus, either the
 * AggregateModel <b>or</b> the {@code aggregateType} should be provided. An AxonConfigurationException is thrown
 * if this criteria is not met.
 *
 * @param builder the {@link Builder} used to instantiate a {@link AggregateAnnotationCommandHandler} instance
 */
protected AggregateAnnotationCommandHandler(Builder<T> builder) {
  builder.validate();
  this.repository = builder.repository;
  this.commandTargetResolver = builder.commandTargetResolver;
  this.supportedCommandNames = new HashSet<>();
  this.handlers = initializeHandlers(builder.buildAggregateModel());
}
origin: org.axonframework/axon-configuration

commandHandler = new Component<>(() -> parent, "aggregateCommandHandler<" + aggregate.getSimpleName() + ">",
                 c -> AggregateAnnotationCommandHandler.<A>builder()
                     .repository(repository.get())
                     .commandTargetResolver(commandTargetResolver.get())
                     .aggregateModel(metaModel.get())
                     .build());
origin: org.axonframework/axon-modelling

/**
 * Instantiate a Builder to be able to create a {@link AggregateAnnotationCommandHandler}.
 * <p>
 * The {@link CommandTargetResolver} is defaulted to amn {@link AnnotationCommandTargetResolver}
 * The {@link Repository} is a <b>hard requirement</b> and as such should be provided.
 * Next to that, this Builder's goal is to provide an {@link AggregateModel} (describing the structure of a given
 * aggregate). To instantiate this AggregateModel, either an {@link AggregateModel} can be provided directly or an
 * {@code aggregateType} of type {@link Class} can be used. The latter will internally resolve to an
 * AggregateModel. Thus, either the AggregateModel <b>or</b> the {@code aggregateType} should be provided.
 *
 * @param <T> the type of aggregate this {@link AggregateAnnotationCommandHandler} handles commands for
 * @return a Builder to be able to create a {@link AggregateAnnotationCommandHandler}
 */
public static <T> Builder<T> builder() {
  return new Builder<>();
}
origin: org.axonframework/axon-modelling

/**
 * Instantiate a {@link AggregateAnnotationCommandHandler} based on the fields contained in the {@link Builder}.
 * <p>
 * Will assert that the {@link Repository} and {@link CommandTargetResolver} are not {@code null}, and will throw
 * an {@link AxonConfigurationException} if either of them is {@code null}. Next to that, the provided Builder's
 * goal is to create an {@link AggregateModel} (describing the structure of a given aggregate). To instantiate this
 * AggregateModel, either an {@link AggregateModel} can be provided directly or an {@code aggregateType} of type
 * {@link Class} can be used. The latter will internally resolve to an AggregateModel. Thus, either the
 * AggregateModel <b>or</b> the {@code aggregateType} should be provided. An AxonConfigurationException is thrown
 * if this criteria is not met.
 *
 * @param builder the {@link Builder} used to instantiate a {@link AggregateAnnotationCommandHandler} instance
 */
protected AggregateAnnotationCommandHandler(Builder<T> builder) {
  builder.validate();
  this.repository = builder.repository;
  this.commandTargetResolver = builder.commandTargetResolver;
  this.supportedCommandNames = new HashSet<>();
  this.handlers = initializeHandlers(builder.buildAggregateModel());
}
origin: org.axonframework/axon-modelling

/**
 * Instantiate the {@link AggregateModel} of generic type {@code T} describing the structure of the Aggregate
 * this {@link AggregateAnnotationCommandHandler} will handle commands for.
 *
 * @return a {@link AggregateModel} of generic type {@code T} describing the Aggregate this {@link
 * AggregateAnnotationCommandHandler} will handle commands for
 */
private AggregateModel<T> buildAggregateModel() {
  if (aggregateModel == null) {
    return inspectAggregateModel();
  } else {
    return aggregateModel;
  }
}
origin: AxonFramework/AxonFramework

/**
 * Instantiate the {@link AggregateModel} of generic type {@code T} describing the structure of the Aggregate
 * this {@link AggregateAnnotationCommandHandler} will handle commands for.
 *
 * @return a {@link AggregateModel} of generic type {@code T} describing the Aggregate this {@link
 * AggregateAnnotationCommandHandler} will handle commands for
 */
private AggregateModel<T> buildAggregateModel() {
  if (aggregateModel == null) {
    return inspectAggregateModel();
  } else {
    return aggregateModel;
  }
}
origin: AxonFramework/AxonFramework

/**
 * Instantiate a Builder to be able to create a {@link AggregateAnnotationCommandHandler}.
 * <p>
 * The {@link CommandTargetResolver} is defaulted to amn {@link AnnotationCommandTargetResolver}
 * The {@link Repository} is a <b>hard requirement</b> and as such should be provided.
 * Next to that, this Builder's goal is to provide an {@link AggregateModel} (describing the structure of a given
 * aggregate). To instantiate this AggregateModel, either an {@link AggregateModel} can be provided directly or an
 * {@code aggregateType} of type {@link Class} can be used. The latter will internally resolve to an
 * AggregateModel. Thus, either the AggregateModel <b>or</b> the {@code aggregateType} should be provided.
 *
 * @param <T> the type of aggregate this {@link AggregateAnnotationCommandHandler} handles commands for
 * @return a Builder to be able to create a {@link AggregateAnnotationCommandHandler}
 */
public static <T> Builder<T> builder() {
  return new Builder<>();
}
origin: AxonFramework/AxonFramework

@SuppressWarnings("unchecked")
@Before
public void setUp() {
  eventStore = spy(EmbeddedEventStore.builder().storageEngine(new InMemoryEventStorageEngine()).build());
  Repository<MyAggregate> myAggregateRepository = EventSourcingRepository.builder(MyAggregate.class)
                                      .eventStore(eventStore)
                                      .build();
  CommandBus commandBus = SimpleCommandBus.builder().build();
  commandGateway = DefaultCommandGateway.builder().commandBus(commandBus).build();
  AggregateAnnotationCommandHandler<MyAggregate> myAggregateCommandHandler =
      AggregateAnnotationCommandHandler.<MyAggregate>builder()
          .aggregateType(MyAggregate.class)
          .repository(myAggregateRepository)
          .build();
  myAggregateCommandHandler.subscribe(commandBus);
}
origin: AxonFramework/AxonFramework

private void registerAggregateCommandHandlers() {
  ensureRepositoryConfiguration();
  if (!explicitCommandHandlersSet) {
    AggregateAnnotationCommandHandler.Builder<T> builder = AggregateAnnotationCommandHandler.<T>builder()
        .aggregateType(aggregateType)
        .parameterResolverFactory(parameterResolverFactory)
        .repository(this.repository);
    if (commandTargetResolver != null) {
      builder.commandTargetResolver(commandTargetResolver);
    }
    AggregateAnnotationCommandHandler<T> handler = builder.build();
    handler.subscribe(commandBus);
  }
}
org.axonframework.modelling.commandAggregateAnnotationCommandHandler$Builder

Javadoc

Builder class to instantiate a AggregateAnnotationCommandHandler.

The CommandTargetResolver is defaulted to an AnnotationCommandTargetResolverThe Repository is a hard requirement and as such should be provided. Next to that, this Builder's goal is to provide an AggregateModel (describing the structure of a given aggregate). To instantiate this AggregateModel, either an AggregateModel can be provided directly or an aggregateType of type Class can be used. The latter will internally resolve to an AggregateModel. Thus, either the AggregateModel or the aggregateType should be provided.

Most used methods

  • build
    Initializes a AggregateAnnotationCommandHandler as specified through this Builder.
  • repository
    Sets the Repository used to add and load Aggregate instances of generic type T upon handling command
  • aggregateType
    Sets the aggregateType as a Class, specifying the type of aggregate an AggregateModelshould be creat
  • commandTargetResolver
    Sets the CommandTargetResolver used to resolve the command handling target. Defaults to an Annotatio
  • <init>
  • aggregateModel
    Sets the AggregateModel of generic type T, describing the structure of the aggregate the AnnotationC
  • inspectAggregateModel
  • parameterResolverFactory
    Sets the ParameterResolverFactory used to resolve parameters for annotated handlers contained in the
  • validate
    Validates whether the fields contained in this Builder are set accordingly.

Popular in Java

  • Reading from database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • runOnUiThread (Activity)
  • setScale (BigDecimal)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now