Top Description Methods
org.jboss.logging.annotations

public @Interface Producer

extends Annotation
Annotations
@Target:PARAMETER
@Retention:CLASS
@Documented
Static Imports
java.lang.annotation.ElementType.PARAMETER, .RetentionPolicy.CLASS

Identifies a parameter has the ability to produce a Throwable or a super type of a Throwable. The parameter type must be a java.util.function.Function or a java.util.function.BiFunction.

For a java.util.function.Function the input parameter must be a String which will be the message associated with the method. The result type must Throwable or a super type of a Throwable.

For a java.util.function.BiFunction one of the input parameters must be a String which will be the message associated with the method. The other input parameter must be a Throwable or a super type of a Throwable and must be assignable from the parameter annotated with Cause. The result type must Throwable or a super type of a Throwable.

Example

@Message("The operation failed due to %s")
 T operationFailed(@Producer Function function, String op);

@Message("The operation failed due to %s")
 T operationFailed(@Producer BiFunction function, @Cause Throwable cause, String op);

Example Usage

throw Bundle.MESSAGES.operationFailed(IllegalArgumentException::new, "start");

throw Bundle.MESSAGES.operationFailed(IllegalStateException::new, cause, "start");

Author
James R. Perkins

Method Summary

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString