Top Description Methods
org.jboss.logging.annotations

public @Interface Signature

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

Specifies the exact signature to use when creating a Throwable return type.

Given the following exception and message bundle interface method the InvalidIntValueException(final RuntimeException cause, final String msg, final int value) constructor would be used.

public class InvalidIntValueException extends RuntimeException {
    private final RuntimeException causeAsRuntime;
    private final int value;
    public InvalidIntValueException(final Throwable cause, final String msg, final int value) {
        super(msg, cause);
        causeAsRuntime = new RuntimeException(cause);
        this.value = value;
    }

    public InvalidIntValueException(final RuntimeException cause, final String msg, final int value) {
        super(msg, cause);
        causeAsRuntime = cause;
        this.value = value;
    }
    public InvalidIntValueException(final RuntimeException cause, final String msg, final Integer value) {
        super(msg, cause);
        causeAsRuntime = cause;
        this.value = value;
    }
}
@Message("Invalid value %d")
@Signature(causeIndex = 0, messageIndex = 1, value = {RuntimeException.class, String.class, int.class}
InvalidIntValueException invalidValue(@Cause RuntimeException cause, @Param int value);

Author
James R. Perkins

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the index for the cause parameter
causeIndex
()

The index for the cause of the exception being created.

public int

Returns:

the index for the message parameter
messageIndex
()

The index for the message.

public Class<?>[]

Returns:

an array of types used to find the signature
value
()

An array of types matching the exact signature to use for the exception being created.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

causeIndexback to summary
public int causeIndex()

The index for the cause of the exception being created. A value of less than zero assumes there is no cause parameter in the constructor. A Cause annotation can still be used and the Throwable#initCause(Throwable) will be used to initialize the cause of the exception.

Returns:int

the index for the cause parameter

messageIndexback to summary
public int messageIndex()

The index for the message. This is the formatted messaged from the Message#value(). This is a required value defaulting to 0 which would be the first parameter.

Returns:int

the index for the message parameter

valueback to summary
public Class<?>[] value()

An array of types matching the exact signature to use for the exception being created.

Returns:Class<?>[]

an array of types used to find the signature