All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.itemis.maven.plugins.cdi.annotations.RollbackOnError Maven / Gradle / Ivy

Go to download

Provides an abstract Mojo that enables CDI-based dependency injection for Maven Plugins.

There is a newer version: 4.0.0
Show newest version
package com.itemis.maven.plugins.cdi.annotations;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import com.itemis.maven.plugins.cdi.CDIMojoProcessingStep;
import com.itemis.maven.plugins.cdi.ExecutionContext;

/**
 * This annotation can be put on any method of an {@link CDIMojoProcessingStep} with the following purpose and
 * restrictions:
 * 
*
* Purpose: As soon as the execution of the Mojo instance has failed throwing an exception, the rollback * method(s) * are called automatically.
*
* Restrictions: *
    *
  • Any return type of the method will be ignored, method should be void!
  • *
  • Method may have one or two parameters: *
      *
    • Max. one of type {@code } which takes the cause of the rollback.
    • *
    • Max. one of type {@link ExecutionContext} to get the context of the original step execution.
    • *
    *
  • *
  • Otherwise the signature must not declare any arguments
  • *
  • If the method signature declares a Throwable as one of its arguments but the type does not match the caught * exception, the method is skipped. If there are other rollback methods declared with matching exception types or * without one, these will be executed as usual.
  • *
* * It is possible to declare several rollback methods! Each method with matching exception types will be executed in * ascending alphabetical order. * * @author Stanley Hillner * @since 1.0.0 */ @Target({ METHOD }) @Retention(RUNTIME) public @interface RollbackOnError { /** * @return the error types for which this rollback method is triggered. */ Class[] value() default {}; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy