jon 02/01/07 08:28:31
Modified: struts/src/java/org/apache/velocity/tools/struts
StrutsBeanTool.java
Log:
properly format code according to:
http://jakarta.apache.org/velocity/code-standards.html
Revision Changes Path
1.2 +32 -21
jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/struts/StrutsBeanTool.java
Index: StrutsBeanTool.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/struts/StrutsBeanTool.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StrutsBeanTool.java 3 Jan 2002 20:21:27 -0000 1.1
+++ StrutsBeanTool.java 7 Jan 2002 16:28:31 -0000 1.2
@@ -71,10 +71,11 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Gabe Sidler</a>
*
- * @version $Id: StrutsBeanTool.java,v 1.1 2002/01/03 20:21:27 geirm Exp $
+ * @version $Id: StrutsBeanTool.java,v 1.2 2002/01/07 16:28:31 jon Exp $
*
*/
-public class StrutsBeanTool implements ContextTool {
+public class StrutsBeanTool implements ContextTool
+{
// --------------------------------------------- Private Properties -------
@@ -105,11 +106,13 @@
*
* @param key Message key
*/
- public String message(String key) {
-
+ public String message(String key)
+ {
MessageResources resources =
ContextHelper.getMessageResources(application);
if (resources == null)
+ {
return null;
+ }
return resources.getMessage(ContextHelper.getLocale(request, session),key);
}
@@ -121,18 +124,24 @@
* @param key Message key to be looked up and returned
* @param args Replacement parameters for this message
*/
- public String message(String key, Object args[]) {
-
+ public String message(String key, Object args[])
+ {
MessageResources resources =
ContextHelper.getMessageResources(application);
- if (resources == null) return null;
-
+ if (resources == null)
+ {
+ return null;
+ }
+
// Return the requested message
if (args == null)
+ {
return (resources.getMessage(ContextHelper.getLocale(request, session),
key));
+ }
else
+ {
return (resources.getMessage(ContextHelper.getLocale(request, session),
key, args));
-
+ }
}
@@ -142,12 +151,15 @@
*
* @param key Message key
*/
- public boolean isMessage(String key) {
-
+ public boolean isMessage(String key)
+ {
// Look up the requested MessageResources
MessageResources resources =
ContextHelper.getMessageResources(application);
- if (resources == null) return false;
+ if (resources == null)
+ {
+ return false;
+ }
// Return the requested message presence indicator
return (resources.isPresent(ContextHelper.getLocale(request, session),
key));
@@ -182,26 +194,25 @@
// --------------------------------------------- ContextTool Interface ----
- /**
+ /**
* A new tool object will be instantiated per-request by calling
* this method. A ContextTool is effectively a factory used to
* create objects for use in templates. Some tools may simply return
* themselves from this method others may instantiate new objects
* to hold the per-request state.
*/
- public Object init( ViewContext context)
- {
+ public Object init( ViewContext context)
+ {
return new StrutsBeanTool(context);
- }
+ }
- /**
+ /**
* At the end of processing this method will be called to
* return the object generated by init(), in case it needs
* to be recycled or otherwise cleaned up.
*/
- public void destroy(Object o)
- {
- }
-
+ public void destroy(Object o)
+ {
+ }
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>