You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by st...@apache.org on 2012/07/08 13:17:39 UTC
git commit: DELTASPIKE-225 update and improve JavaDoc
Updated Branches:
refs/heads/master 6055b4255 -> bf6f4f079
DELTASPIKE-225 update and improve JavaDoc
Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/bf6f4f07
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/bf6f4f07
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/bf6f4f07
Branch: refs/heads/master
Commit: bf6f4f079ee56a1e5aa6a1eaa8211b544a2e9d7e
Parents: 6055b42
Author: Mark Struberg <st...@apache.org>
Authored: Sun Jul 8 13:16:06 2012 +0200
Committer: Mark Struberg <st...@apache.org>
Committed: Sun Jul 8 13:16:06 2012 +0200
----------------------------------------------------------------------
.../core/api/message/annotation/MessageBundle.java | 14 ++++++++-
.../message/annotation/MessageContextConfig.java | 14 +++++++++-
.../api/message/annotation/MessageTemplate.java | 21 ++++++++++++++-
3 files changed, 45 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/bf6f4f07/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageBundle.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageBundle.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageBundle.java
index 8f38f0e..d4c86ef 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageBundle.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageBundle.java
@@ -26,12 +26,22 @@ import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
- * <p>Marker annotation for a message-bundle interface which provides type-safe messages
- * (methods annotated with {@link MessageTemplate}).</p>
+ * <p>Marker annotation for a message-bundle interface which provides type-safe messages.
+ * Each method on such an interface will form a type-safe message. The message lookup key
+ * (resource bundle key) can either be defined by annotating those methods
+ * with @{@link MessageTemplate}) or by convention. if no @{@link MessageTemplate}
+ * annotation is used on a method, it's name will be used as resource key.</p>
*
* <p>This annotation must only be used on interfaces.
* If this annotation gets used on a concrete class, a deployment error results!</p>
*
+ * <p>The {@link java.util.ResourceBundle} or other resource lookup source is
+ * determined by the {@link org.apache.deltaspike.core.api.message.MessageResolver}
+ * in conjunction with
+ * {@link org.apache.deltaspike.core.api.message.MessageContext#messageSource(String...)}.
+ * The fully qualified class name of the interface annotated with
+ * @MessageBundle will automatically be registered as additional <code>messageSource</code>!</p>
+ *
* <p>Can be combined with {@link MessageContextConfig} to customize the
* message-resolution and processing.</p>
*/
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/bf6f4f07/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageContextConfig.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageContextConfig.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageContextConfig.java
index c2ed429..d195e1e 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageContextConfig.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageContextConfig.java
@@ -39,7 +39,19 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
public @interface MessageContextConfig
{
/**
- * Optional custom message-source.
+ * <p>Additional message-source.</p>
+ *
+ * <p>A message-source is a lookup hint for the {@link MessageResolver}.
+ * For the default MessageResolver this is the name of the
+ * {@link java.util.ResourceBundle}.</p>
+ *
+ * <p>Example: For using 2 additional ResourceBundles for the lookup,
+ * you can use the MessageContextConfig like that:
+ * <pre>
+ * @MessageBundle
+ * @MessageContextConfig(messageSource = {"mycomp.ErrorMessages","mycomp.BusinessMessages"})
+ * public interface MyCompanyMessages {...
+ * </pre>.</p>
* @return classes of the message-sources
*/
String[] messageSource() default { };
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/bf6f4f07/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageTemplate.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageTemplate.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageTemplate.java
index dfdb02e..166038a 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageTemplate.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/message/annotation/MessageTemplate.java
@@ -26,10 +26,29 @@ import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
- * <p>Provides the message(-template) for type-safe messages</p>
+ * <p>Provides the message(-template) for type-safe messages.</p>
*
* <p>This only works on interfaces which are annotated with
* {@link MessageBundle}.</p>
+ *
+ * <p>Depending on the {@link org.apache.deltaspike.core.api.message.MessageResolver}
+ * this message-template value might be used as key to lookup internationalized values
+ * from a {@link java.util.ResourceBundle}.</p>
+ *
+ * <p>A MessageTemplate value which starts and ends with bracelets '{', '}' will
+ * be interpreted as key for resolving from a ResourceBundle or any other lookup mechanism
+ * determined by the {@link org.apache.deltaspike.core.api.message.MessageResolver}.
+ * A small example:
+ * <pre>
+ * @MessageTemplate("{welcome_to}")
+ * </pre>
+ * This will lookup a <code>welcome_to = Hello to Aruba</code> from the configured
+ * resource bundle.
+ * </p>
+ *
+ *
+ * <p>MessageTemplate values without '{', '}' bracelets will be directly used
+ * without resource lookup</p>
*/
@Target(METHOD)
@Retention(RUNTIME)