Source Code Cross Referenced for MessageLocator.java in  » Web-Framework » RSF » uk » org » ponder » messageutil » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » RSF » uk.org.ponder.messageutil 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*
02:         * Created on Dec 3, 2004
03:         */
04:        package uk.org.ponder.messageutil;
05:
06:        import uk.org.ponder.beanutil.BeanLocator;
07:        import uk.org.ponder.beanutil.BeanResolver;
08:
09:        /**
10:         * Core interface supporting lookup of localised messages. Very similar to
11:         * Spring's MessageSource, only with a greater flexibility of lookup, and the
12:         * dependency on the Locale has been factored off into a request-scope
13:         * dependency.
14:         * <p/>
15:         * MessageLocator also supports use as either a BeanLocator (hence messages may
16:         * be addressed directly via EL as <code>#{messageLocator.message-key}</code>)
17:         * or as BeanResolver (hence messages may be automatically fetched during
18:         * component fixup stage in RSF by declaring the <code>resolver</code> field
19:         * in a <code>UIBound</code> to be targetted at the EL
20:         * <code>#{messageLocator}</code>.
21:         * 
22:         * @author Antranig Basman (antranig@caret.cam.ac.uk)
23:         * 
24:         */
25:        public abstract class MessageLocator implements  BeanLocator,
26:                BeanResolver {
27:            /**
28:             * @see #getMessage(String, Object[])
29:             * @param code An array of potential message codes to be looked up, in order
30:             * of priority. Each code will be looked up in turn and the resolved message
31:             * from the first which is found will be returned, if any. This strategy 
32:             * matches that of Spring's MessageSourceResolvable.
33:             */
34:            public abstract String getMessage(String[] code, Object[] args);
35:
36:            /** Resolve a defaultible message which takes no arguments 
37:             * @see #getMessage(String[], Object[]) **/
38:            public String getMessage(String[] code) {
39:                return getMessage(code, null);
40:            }
41:
42:            public String getMessage(String code) {
43:                return getMessage(code, (Object[]) null);
44:            }
45:
46:            /**
47:             * @param code the code to lookup up, such as 'calculator.noRateSet'
48:             * @param args Array of arguments that will be filled in for params within the
49:             *          message (params look like "{0}", "{1,date}", "{2,time}" within a
50:             *          message), or <code>null</code> if none.
51:             * @return the resolved message, or a default message if not found.
52:             */
53:            public String getMessage(String code, Object[] args) {
54:                return getMessage(new String[] { code }, args);
55:            }
56:
57:            public String getMessage(String[] code, Object param) {
58:                return getMessage(code, new Object[] { param });
59:            }
60:
61:            public String getMessage(String code, Object param) {
62:                return getMessage(new String[] { code }, new Object[] { param });
63:            }
64:
65:            /** @see BeanLocator#locateBean(String)
66:             */
67:            public Object locateBean(String path) {
68:                return getMessage(new String[] { path }, null);
69:            }
70:
71:            /** @see BeanResolver#resolveBean(Object)
72:             */
73:
74:            public String resolveBean(Object bean) {
75:                return getMessage((String) bean, null);
76:            }
77:
78:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.