You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2020/11/22 00:04:23 UTC
[tapestry-5] branch java9modules updated: TAP5-2641: making it
possible to get a Messages instance
This is an automated email from the ASF dual-hosted git repository.
thiagohp pushed a commit to branch java9modules
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git
The following commit(s) were added to refs/heads/java9modules by this push:
new 9c27cbe TAP5-2641: making it possible to get a Messages instance
9c27cbe is described below
commit 9c27cbec6d27afa7cec19f65c321ffb046cfb736
Author: Thiago H. de Paula Figueiredo <th...@arsmachina.com.br>
AuthorDate: Sat Nov 21 21:04:05 2020 -0300
TAP5-2641: making it possible to get a Messages instance
without going directly to MessagesImpl
---
.../main/java/org/apache/tapestry5/commons/Messages.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/commons/src/main/java/org/apache/tapestry5/commons/Messages.java b/commons/src/main/java/org/apache/tapestry5/commons/Messages.java
index a18a251..e618a22 100644
--- a/commons/src/main/java/org/apache/tapestry5/commons/Messages.java
+++ b/commons/src/main/java/org/apache/tapestry5/commons/Messages.java
@@ -16,6 +16,8 @@ package org.apache.tapestry5.commons;
import java.util.Set;
+import org.apache.tapestry5.commons.internal.util.MessagesImpl;
+
/**
* Provides access to a messages catalog, a set of properties files that provide localized messages for a particular
* locale. The message catalog consists of keys and values and follows the semantics of a Java {@link
@@ -58,4 +60,17 @@ public interface Messages
* @since 5.4
*/
Set<String> getKeys();
+
+ /**
+ * Finds the messages for a given Messages utility class. Strings the trailing "Messages" and replaces it with
+ * "Strings" to form the base path. Loads the bundle using the default locale, and the class' class loader.
+ *
+ * @param forClass
+ * @return Messages for the class
+ */
+ public static Messages forClass(Class forClass)
+ {
+ return MessagesImpl.forClass(forClass);
+ }
+
}