Introduce alias for 'value' attribute in @SendToUser

Issue: SPR-11393
This commit is contained in:
Sam Brannen
2015-06-01 14:14:23 +02:00
parent 53d095aa28
commit ab24592662
2 changed files with 32 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,13 +22,16 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
/**
* Annotation that indicates the return value of a message-handling method should
* be sent as a {@link org.springframework.messaging.Message} to the specified
* destination(s) prepended with {@code "/user/{username}"} where the user
* name is extracted from the headers of the input message being handled.
* Annotation that indicates that the return value of a message-handling method
* should be sent as a {@link org.springframework.messaging.Message} to the specified
* destination(s) prepended with <code>"/user/{username}"</code> where the user name
* is extracted from the headers of the input message being handled.
*
* @author Rossen Stoyanchev
* @author Sam Brannen
* @since 4.0
* @see org.springframework.messaging.simp.annotation.support.SendToMethodReturnValueHandler
* @see org.springframework.messaging.simp.user.UserDestinationMessageHandler
@@ -40,12 +43,22 @@ import java.lang.annotation.Target;
public @interface SendToUser {
/**
* One or more destinations to send a message to. If left unspecified, a
* default destination is selected based on the destination of the input
* message being handled.
* Alias for {@link #destinations}.
* @see #destinations
*/
@AliasFor(attribute = "destinations")
String[] value() default {};
/**
* One or more destinations to send a message to.
* <p>If left unspecified, a default destination is selected based on
* the destination of the input message being handled.
* @since 4.2
* @see #value
* @see org.springframework.messaging.simp.annotation.support.SendToMethodReturnValueHandler
*/
String[] value() default {};
@AliasFor(attribute = "value")
String[] destinations() default {};
/**
* Whether messages should be sent to all sessions associated with the user